Starting a django project

Start a new Django project?.

After installation of Django, we can create a new project.

Django can be used to create websites and web apps. You need to type in some terminal
commands to start a new Django project.

You may like: Python and Django Full Stack Web Developer Bootcamp

Create Django project

Open the command prompt, then enter your projects directory.

mkdir projects
cd projects
mkdir django_example
cd django_example

Then we use django-admin tool.

django-admin startproject mywebsite
cd mywebsite
Note: If you list the files in the new directory, you’ll see manage.py and the skeleton project.

Django start server

Start the developent web server.

python manage.py runserver

It’ll output lots of things:

Performing system checks…

System check identified no issues (0 silenced).

You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run ‘python manage.py migrate’ to apply them.

July 19, 2017 – 20:54:09
Django version 1.11.3, using settings ‘mywebsite.settings’
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Note: On the last line, you’ll see the address: http://127.0.0.1:8000/
Open that address in your webbrowser.

 
You’ll see the basic Django template:

django new project

 
If you see this screen, you have now successfully created a new Django project.

Previous Post
Next Post

Leave a Reply