ruk·si

Django Tutorial
Create Project

Updated at 2018-11-23 16:14

This note contains step by step instructions to create a simple polling web application using Django. A great way to refresh Django knowledge.

Create a virtual environment:

# some virtualenv macro magic over here, creating a Python virtual env
vmk3 djangor
v djangor
pip install pip-tools

Define initial project dependencies:

echo -e "pip-tools" >> requirements-dev.in
pip-compile --output-file requirements-dev.txt requirements-dev.in
pip install -r requirements-dev.txt

echo -e "django" >> requirements.in
pip-compile --output-file requirements.txt requirements.in
pip install -r requirements.txt

Generate project template:

django-admin startproject djangor .

Enable Django support if using PyCharm:

Settings > Languages & Frameworks > Django

Commit the initial state to version control:

git init
echo -e ".idea/\n*.sqlite3" >> .gitignore
git add -A
git commit -m 'Init Django project'