Kevser
Learning score: 3
Current streak: 0 days
Best streak: 1 day
Joined: 17 December 2020
Total activity: 3 days
Learning topics:
Back-end development
Front-end development
Foreign language
Computer science
DevOps
Personal development
  • Kevser 24 days ago
    Personal development
    Grand Retrospective
  • Kevser 3 months ago
    Back-end development
    Error:
    ImportError: dlopen(/path/to/pyenv/fuar-uygulamasi/env/lib/python3.8/site-packages/MySQLdb/_mysql.cpython-38-darwin.so, 2): Library not loaded: libssl.1.1.dylib
      Referenced from: /path/to/pyenv/fuar-uygulamasi/env/lib/python3.8/site-packages/MySQLdb/_mysql.cpython-38-darwin.so
      Reason: image not found

    Solution
    export DYLD_LIBRARY_PATH=/usr/local/mysql/lib
  • Kevser 3 months ago
    Back-end development
    Django get database settings from file

    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'OPTIONS': {
                'read_default_file': '.my.cnf',
            },
        }
    }
    

    .my.cnf file 
    [client]
    database = blog_data
    user = djangouser
    password = your_actual_password
    default-character-set = utf8
  • Kevser 3 months ago
    DevOps

    Error Fix 


    Osx virtualenv python error after software update

    Error message:
    ➜ xxxxxx git:(master) ✗ virtualenv env
    zsh: no such file or directory: /Library/Frameworks/Python.framework/Versions/3.9/bin/virtualenv

    ➜  xxxxx git:(master) ✗ pip install virtualenv
    Requirement already satisfied: virtualenv in /usr/local/lib/python3.9/site-packages (20.2.2)
    Requirement already satisfied: appdirs<2,>=1.4.3 in /usr/local/lib/python3.9/site-packages (from virtualenv) (1.4.4)
    Requirement already satisfied: six<2,>=1.9.0 in /usr/local/lib/python3.9/site-packages (from virtualenv) (1.15.0)
    Requirement already satisfied: filelock<4,>=3.0.0 in /usr/local/lib/python3.9/site-packages (from virtualenv) (3.0.12)
    Requirement already satisfied: distlib<1,>=0.3.1 in /usr/local/lib/python3.9/site-packages (from virtualenv) (0.3.1)

    Solution:

    python3 -m venv venv
    source ./venv/bin/activate
    or use pyenv and delete brew python versions because error is caused by brew

  • Kevser 3 months ago
    Back-end development
    Create mobile and desktop request  on Python 

    Return => response , decoded response body

    mobile_user_agent = ''
    desktop_user_agent = ''
    def create_request(url, is_mobile):
        try:
            if is_mobile:
                res = requests.get(url, headers={'user-agent': mobile_user_agent})
    
            res = requests.get(url, headers={'user-agent': desktop_user_agent})
    
            if res.status_code is not 200:
                return res, ''
    
            res_page_source = res.content.decode('utf-8')
            return res, res_page_source
        except Exception as ex:
            print(ex)
            return "", ""

  • Kevser 3 months ago
    DevOps
    Serverless installation

    $ npm install -g serverless


    Serverless AWS Configuration

    $ serverless config credentials --provider aws --key <aws-key> -secret <aws-secret-key> -profile custom-profile

    Serverless Python Requirements Plugin Installation

    $ serverless plugin install -n serverless-python-requirements

    Serverless Lambda  Example with Python Plugin
    service: python-lambda-example
    
    provider:
      name: aws
      runtime: python3.6
      region: us-east-1
      timeout: 900
      memorySize: 1024
    
    functions:
      hello:
        handler: handler.hello
        description: Description for python lambda
        layers:
          - <layer arn>
    
    plugins:
      - serverless-python-requirements
    custom:
      pythonRequirements:
        dockerizePip: non-linux

    Serverless Deployment
    $ serverless deploy

    Serverless Deployment History

    $ serverless deploy list

    Serverless Invoke


    # local
    $ serverless invoke local --function functionName

    #aws
    $ serverless invoke --function functionName --stage dev --region us-east-1

    # aws with data
    $ serverless invoke --function functionName --stage dev --region us-east-1 --data "hello world"