#!/usr/bin/env python # coding: utf-8 # # Chapters 18, 19 and 20 # ## Building and deploying a Learning Log with Django and Heroku # This project is currently deployed and useable on a Heroku instance at # ![](images/learning_log_screenshot.png) # ### Running the app locally # #### Installing virtualenv # ``` # $ python3 -m venv ll_env # $ pip3install virtualenv # $ cd learning_log # learning_log$ virtualenv ll_env # ``` # # #### Activating the virtual environment # ``` # learning_log$ source ll_env/bin/activate # (ll_env)learning_log$ # ``` # # #### Installing Django # ``` # (ll_env)learning_log$ pip install Django # ``` # # #### Running migrations # ``` # (ll_env)learning_log$ python manage.py migrate # ``` # # #### Running the app # ``` # (ll_env)learning_log$ python manage.py runserver # Performing system checks... # # System check identified no issues (0 silenced). # December 18, 2017 - 01:43:04 # Django version 2.0, using settings 'learning_log.settings' # Starting development server at http://127.0.0.1:8000/ # Quit the server with CONTROL-C. # ``` # Visit http://127.0.0.1:8000/ in a browser. # ### Deploying the app with Heroku # ``` # (ll_env)learning_log$ heroku login # ... # (ll_env)learning_log$ heroku create # ... # ``` # _Because we want to just deploy a subdirectory of the notebooks Git project, we run:_ # ``` # (ll_env)learning_log$ cd ../../ # (ll_env)$ git subtree push --prefix python_crash_course/learning_log heroku master # ``` # ### Migrating on Heroku instance # ``` # (ll_env)learning_log$ cd python_crash_course/learning_log # (ll_env)$ heroku run python manage.py migrate # ``` # In[ ]: