DEV Community

Cover image for Start using Django in 2 mins
Ordinary Coders
Ordinary Coders

Posted on • Originally published at ordinarycoders.com

 

Start using Django in 2 mins

1) Create a Python virtual environment

C:\Users\Owner> cd desktop
C:\Users\Owner\desktop> py -m venv env
C:\Users\Owner\desktop> cd env
C:\Users\Owner\desktop\env> Scripts\activate
(env)C:\Users\Owner\desktop\env>
Enter fullscreen mode Exit fullscreen mode

2) Install Django

(env)C:\Users\Owner\desktop\env> pip install django
Enter fullscreen mode Exit fullscreen mode

3) Make sure Django installed

(env)C:\Users\Owner\desktop\env> pip show django
Enter fullscreen mode Exit fullscreen mode

4) Create the Django project

(env)C:\Users\Owner\desktop\env> django-admin startproject mysite
Enter fullscreen mode Exit fullscreen mode

5) Create a Django app

(env)C:\Users\Owner\desktop\env> cd mysite
(env)C:\Users\Owner\desktop\env\mysite> py manage.py startapp main
Enter fullscreen mode Exit fullscreen mode

6) Run the local development server

(env) C:\Users\Owner\Desktop\Code\env\mysite>py manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
You have 17 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.
February 26, 2019 - 09:54:26
Django version 3.0.6, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-C.
Enter fullscreen mode Exit fullscreen mode

7) Open the development server address in your browser
Look for the address http://127.0.0.1:8000/ above in the CLI then copy and paste this URL in a new browser window. A web page with a rocket will appear stating your installation was successful.

8) Congrats! You now have a Django project. From here, you need to configure your web app to display your custom templates.

Full tutorial

Top comments (0)

50 CLI Tools You Can't Live Without

The top 50 must-have CLI tools, including some scripts to help you automate the installation and updating of these tools on various systems/distros.