Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pebreo
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pebreo/2abeaec2330162cf8c8c to your computer and use it in GitHub Desktop.
Save pebreo/2abeaec2330162cf8c8c to your computer and use it in GitHub Desktop.
DjangoGirls Chicago Notes

DjangoGirls Tutorial Notes

Below are some notes taken from the DjangoGirls Chicago workshop.

Linux/MacOS-specific Commands

Command(Apple)+Space and search for Terminal

cd mydir  # change directory
cd ..   # go up a directory
mkdir  # create a directory
rm -rf mydir # delete a directory and children
pwd -P # print the full directory path

Windows-specific Commands

Search for the PowerShell program
cd mydir
cd .. # go up a directory
mkdir mydir
rmdir /S mydir

Start a Django project in Linux/MacOS

python -m venv myvenv
source myvenv/bin/activate
python -m pip install Django==1.8
mkdir djangogirls
cd djangogirls
django-admin.py startproject mysite .
python manage.py startapp blog

TODO
Edit settings.py for timezone, language, database
Edit blog: views.py, urls.py, models.py
Edit mysite: urls.py

Django command reference (no particular order)

# start a project called mysite (assumes your are in empty directory)
django-admin.py startproject mysite . 

# run the development server
python manage.py runserver 

# collect static files to a single destination 
python manage.py collectstatic

# create superuser to be able to login to admin
python manage.py createsuperuser

Django Migrations Commands

# Run these commands whenever you first touch or change your models.py file
python manage.py makemigrations
python manage.py migrate

# Run this command the very first time you create a project on a machine
python manage.py migrate

PythonAnywhere Deployment Steps

# Step 1. Create a git repo
git init 
git add -A

# Step 2. Commit a git repo
git commit -m "my initial commit"

# Step . Add the remote repo address to your local repo
TODO
git remote add 

# Step 3. Push the local git repo to GitHub
git push origin master

Step 4. Create virtualenv environment on webserver
TODO:
Step . Install Django and Wheel
Step . Collect static files
Step . Run migrations (e.g. create necessary data tables)
Step . Configure the virtualenv setting for PythonAnywhere
Step . Configure the wsgi.py file for PythonAnywhere
Step . Pull down code from GitHub 
Step . Reload the server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment