{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapters 18, 19 and 20\n", "## Building and deploying a Learning Log with Django and Heroku" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This project is currently deployed and useable on a Heroku instance at " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](images/learning_log_screenshot.png)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Running the app locally\n", "#### Installing virtualenv\n", "```\n", "$ python3 -m venv ll_env\n", "$ pip3install virtualenv\n", "$ cd learning_log\n", "learning_log$ virtualenv ll_env\n", "```\n", "\n", "#### Activating the virtual environment\n", "```\n", "learning_log$ source ll_env/bin/activate\n", "(ll_env)learning_log$\n", "```\n", "\n", "#### Installing Django\n", "```\n", "(ll_env)learning_log$ pip install Django\n", "```\n", "\n", "#### Running migrations\n", "```\n", "(ll_env)learning_log$ python manage.py migrate\n", "```\n", "\n", "#### Running the app\n", "```\n", "(ll_env)learning_log$ python manage.py runserver\n", "Performing system checks...\n", "\n", "System check identified no issues (0 silenced).\n", "December 18, 2017 - 01:43:04\n", "Django version 2.0, using settings 'learning_log.settings'\n", "Starting development server at http://127.0.0.1:8000/\n", "Quit the server with CONTROL-C.\n", "```\n", "Visit http://127.0.0.1:8000/ in a browser." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Deploying the app with Heroku\n", "```\n", "(ll_env)learning_log$ heroku login\n", "...\n", "(ll_env)learning_log$ heroku create\n", "...\n", "```\n", "_Because we want to just deploy a subdirectory of the notebooks Git project, we run:_\n", "```\n", "(ll_env)learning_log$ cd ../../\n", "(ll_env)$ git subtree push --prefix python_crash_course/learning_log heroku master\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Migrating on Heroku instance\n", "```\n", "(ll_env)learning_log$ cd python_crash_course/learning_log\n", "(ll_env)$ heroku run python manage.py migrate\n", "```" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.3" } }, "nbformat": 4, "nbformat_minor": 2 }