Getting up and running with Django
This is quick guide to getting a Django project running on PC or Mac.
Firstly install python, visit https://www.python.org/downloads/ and select the download for your environment.
Create a new directory on your file system for your new project either using the windows/mac os or command line:
Then enter the new directory:
Within this directory, create a new python virtual environment:
python3 -m venv venv
python -m venv venv
On my PC, as python is the only installed version I only need use the ‘python’ command. As you can see above, however on my Mac I use the ‘python3’ command as I have Python 2.7 installed from working with Python in Maya.
Activate the virtual environment:
Install Django into the Virtual Environment:
pip install Django
Once Django is installed in the venv (Virtual Environment), create a new project:
django-admin startproject <project_name>
This will create the folder structure and starting files in the project directory. At this point you will have a confusing number of nested directories, we can move everything up by 1 level:
mv <project_name>/manage.py ./ mv <project_name>/<project_name>/* <project_name> rm -r <project_name>/<project_name>/
Finally start the project with:
python manage.py runserver