Skip to content

Latest commit

 

History

History
96 lines (58 loc) · 1.92 KB

README.md

File metadata and controls

96 lines (58 loc) · 1.92 KB

Run development env under pyenv (https://github.com/yyuu/pyenv)

We will run Postgres and Redis inside docker and web app on local host (for easy debugging)

  • Prerequisites

    • Install Docker Toolbox
    • Create and start a 'dev' Docker machine
       docker-machine start dev
    
  • Run Postgres docker container

        docker-compose up -d postgres
    
  • Activate python env

        source ~/.pyenv/envs/3.4.3/bin/activate
    
    
  • Install required Python packages

        cd to project/web directory
        pip install -r requirements.txt
    
    
  • Load env variables

    • rename .env_example to .env and update credentials
        source .env
        export $(cat .env | xargs)
    
        # check env set correctly
        echo $SECRET_KEY
    
    
  • Setup Postgres database

        python migrate.py db init           # only first time
        python migrate.py db revision --autogenerate
        python migrate.py db upgrade
        
    
        python web/create_db.py
    
    
    • Create an app to use
        python manage.py create_app --name "CloudPhotos"
    
    
  • Setup reverse proxy url to use for oAuth callbacks to localhost

    • On a new shell, run:
        ~/dev/ngrok http 9001
    
    
  • Run web app from pycharm

    • Define environment variables under run configuration