Added Django commands.

This commit is contained in:
Donne Martin 2015-06-10 16:40:21 -04:00
parent 0cc73c682b
commit 3d85970eb5
2 changed files with 71 additions and 0 deletions

View File

@ -205,6 +205,7 @@ IPython Notebook(s) demonstrating various command lines for Linux, Git, etc.
| [git](http://nbviewer.ipython.org/github/donnemartin/data-science-ipython-notebooks/blob/master/commands/misc.ipynb#git) | Distributed revision control system with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. |
| [ruby](http://nbviewer.ipython.org/github/donnemartin/data-science-ipython-notebooks/blob/master/commands/misc.ipynb#ruby) | Used to interact with the AWS command line and for Jekyll, a blog framework that can be hosted on GitHub Pages. |
| [jekyll](http://nbviewer.ipython.org/github/donnemartin/data-science-ipython-notebooks/blob/master/commands/misc.ipynb#jekyll) | Simple, blog-aware, static site generator for personal, project, or organization sites. Renders Markdown or Textile and Liquid templates, and produces a complete, static website ready to be served by Apache HTTP Server, Nginx or another web server. |
| [django](http://nbviewer.ipython.org/github/donnemartin/data-science-ipython-notebooks/blob/master/commands/misc.ipynb#django) | High-level Python Web framework that encourages rapid development and clean, pragmatic design. It can be useful to share reports and analyses. There are Django apps such as Mezzanine that open up Django to data content management and blogging. |
## notebook-installation

View File

@ -382,6 +382,76 @@
"# Auto-regeneration: enabled. Use `--no-watch` to disable.\n",
"!bundle exec jekyll serve"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Django"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[Django](https://www.djangoproject.com) is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Django can be useful to share data reports and analyses on the web. There are Django apps such as [Mezzanine](http://mezzanine.jupo.org) that open up Django to data content management and blogging."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Check version of Django\n",
"!python -c \"import django; print(django.get_version())\"\n",
"\n",
"# Create and setup a project\n",
"!django-admin startproject mysite\n",
"\n",
"# Sync db\n",
"!python manage.py syncdb\n",
"\n",
"# The migrate command looks at the INSTALLED_APPS setting and \n",
"# creates any necessary database tables according to the database \n",
"# settings in your mysite/settings.py file and the database \n",
"# migrations shipped with the app\n",
"!python manage.py migrate\n",
"\n",
"# Run the dev server\n",
"!python manage.py runserver\n",
"1python manage.py runserver 8080\n",
"!python manage.py runserver 0.0.0.0:8000\n",
"\n",
"# Create app\n",
"!python manage.py startapp [app_label]\n",
"\n",
"# Run tests\n",
"python manage.py test [app_label]\n",
"\n",
"# Tell Django that youve made some changes to your models \n",
"# and that youd like the changes to be stored as a migration.\n",
"!python manage.py makemigrations [app_label]\n",
"\n",
"# Take migration names and returns their SQL\n",
"!python manage.py sqlmigrate [app_label] [migration_number]\n",
"\n",
"# Checks for any problems in your project without making \n",
"# migrations or touching the database.\n",
"!python manage.py check\n",
"\n",
"# Create a user who can login to the admin site\n",
"!python manage.py createsuperuser\n",
"\n",
"# Locate Django source files\n",
"!python -c \"\n",
"import sys\n",
"sys.path = sys.path[1:]\n",
"import django\n",
"print(django.__path__)\""
]
}
],
"metadata": {