Starting a Django Project in Pycharm

Posted by PythonStacks on October 26, 2020

In this tutorial, you would learn how to quickly install django, start a django project, and run your project on a server.

Django is one of the most popular open-source web development framework written in Python.

It is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

To use django, python is required therefore you must have python installed and perhaps an ide like pycharm or Anaconda. An IDE is not mandatory but they improve your productivity.


Note: IDE - Integrated Development Environments - is a software application that provides comprehensive facilities to computer programmers for software development.

Examples of IDEs for Python is Pycharm and Anaconda

Though the tutorial is aimed at starting a Django project in pycharm, the process is very similar in other IDEs.


Installing Django

Start with creating a new python project in pycharm. Pycharm automatically creates a virtual environment for handling your packages.

Open the terminal which can be opened from the bar at the bottom of the window. It will open a command line.

Then run the following code to install django:

pip install django


This installs the django package for your project.

Installation of packages using pip requires an internet connection.


Creating a Django Project

To create a django project, go back to the terminal and run the following command:

django-admin startproject myproject

myproject is the name of your Django project, you could replace it with any name.


After running this command, Django automatically creates some new files: a new directory called “myproject” with the basic Django directory and structures:



These files are:

  • The outer myproject/ root directory is a container for your project.
  • A command-line utility that lets you interact with this Django project in various ways.
  • The inner mysite/ directory is the actual Python package for your project.
  • myproject/ An empty file that tells Python that this directory should be considered a Python package. If you’re a Python beginner, read more about packages in the official Python docs.
  • myproject/ Settings/configuration for this Django project
  • myproject/ The URL declarations for this Django project; a “table of contents” of your Django-powered site.
  • myproject/ An entry-point for ASGI-compatible web servers to serve your project.
  • myproject/ An entry-point for WSGI-compatible web servers to serve your project.


You should not worry about understanding what these files are.


Running a Django project

Now that we have created a Django project we can open it in a browser. Django comes with a built-in web server for development.

Navigate to the Base directory where is by running the following command in the terminal.

cd myproject

Then run the command below

python runserver

After this command runs successfully, it would give you a link to access your Django project open this link in a browser.


If everything went right you should see the default page of Django.


To stop the server press ctrl + c in the terminal window.




There is more after creating a Django project. Enter your email in the subscription box to get notified of new tutorials.


Share This Post

Tweet Share Share Share

Subscribe to receive updates!


Leave a comment

* Email would not published