Django Quick Start Tutorial

This Django quick start guide will help you get a Django project off the ground quickly. Bookmark this page to remember all the necessary commands to get moving fast!

First, install Django using pip. I recommend doing this in an virtual environment, docker container, or other container.

Second, use django-admin startproject to initialize your project. IMPORTANT: Don’t forget the ‘.’ after your project name.

Third, use python manage.py migrate to generate a database for your project.

Fourth, run the command python manage.py runserver. Then navigate to 127.0.0.1:8000 or localhost:8000 to verify your Django app is up and running.

pip install django
django-admin startproject burger_joint .
python manage.py migrate
python manage.py runserver

If everything was successful, you’ll see the Django startup page below.


The next step is to start your app. Django uses “apps” to provide site functionality to your project. We start an app using the manage.py startapp command.

python manage.py startapp burgers

This command creates a number of different files for your application in the current directory.

If you’ve exited your container or stopped your server and need to restart it, just type the following code. You don’t need to restart the app.

python manage.py runserver

By default, Django will start the webserver to listen on port 8000. If you need to specify a different port, just add it after runserver in the command line. In the following code we tell Django to use port 8080 instead of 8000.

python manage.py runserver 8080

You’ve now setup a Django server and started your first app. You can move onto setting up the data model for your app!

Head over to my next post about setting up your app models.

John

Leave a Reply

Your email address will not be published. Required fields are marked *