Starting a simple Django project.

2018, Aug 25    

Starting a simple Django project

Follow these steps one by one

1. First of all install virtualenvwrapper. Follow instructions on official documentationpage.

2. Once you’ve installed virtualenvwrapper, create a directory with the name of your project. For example

$ mkdir demo_app
# then goto the created directory by
$ cd demo_app

3. Once you’re in your demo_app directory, create a virtual environment in the same directory by running following command

$ mkvirtualenv demo_app -a "$(pwd)" -p python3.6

4. Now your virtual environment has been setup. After running the previous command, your virtual env should be activated automatically, if not please run

$ workon demo_app

5. Now you are in your virtual evn. Before we start installing dependecies directly into our virtual environment, it’s better to list them first in requirements.txt file. Create a file named requirements.txt in demo_app directory

$ touch requirements.txt

6. In your requirements.txt file, you should add the following text:


7. Now, run pip install -r requirements.txt to install Django.

8. Once Django is installed, you are ready to start your first Django app. Run the following command

$ django-admin startproject demo_app .

9. Now you should have following file structure

├── demo_app
│   ├──
│   ├──
│   ├──
│   └──
└── requirements.txt

10. Now run the initial database migrations via running following command from the directory which contains file

$ python migrate

11. Finally run python migrate command to start the server

$ python runserver

Voila!!! Your project is up and running

Django Home page

Link to GitHub Gist