Technology

How to setup and run Django server in PyCharm Community Edition?

Last updated on February 19th, 2024 at 03:10 pm

3 minutes read

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. It lets developers use the same language they know to build the entire stack of their applications. This tutorial will walk you through the process of setting up a Django server in PyCharm Community Edition.

 

1, Open ‘PyCharm’ and create a new project. You can download the PyCharm here.

create a new project

Set the interpreter and check the ‘main.py’ then click Create.

Note: Creating project may sometime takes time.

2, Go to your project directory and delete the ‘main.py’.

delete mainpy
3, Back to PyCharm. Start a Terminal  and type: django-admin startproject mysite
create a project in terminal

4. Back to your Project directory, moved ‘manage.py’ to root directory. Move all the files files from mysite directory to upper level directory. Delete the empty  mysite directory.

Project directory can be found in C:\Users\<Your PC Username>\PycharmProjects

move all files to root directory

Django project is now ready . You can now start creating an app.

5, Create a Django App by typing in terminal: django-admin startapp polls

Replace ‘polls’ with your app name.

create a django app in terminal

Note: Community Edition doesn’t handle manage.py. So, we need to do some configuration on next steps.

6, On PyCharm, click ‘Run’ on menu then click ‘Edit Configuration’. Delete ‘main’ and click ‘+’ sign. Add new ‘Python’

configuring django

Enter ‘Django’ name. In ‘Script path’, select ‘manage.py’. Enter ‘runserver’ in Parameters. Click ‘Apply’ and ‘OK’.

7, Now everything is all setup, lastly, click the ‘Play’ button next to Django to start the Django server.

click to start the server
django server is now starting

8, With the Ctrl key down, click the http://127.0.0.1:8000/ to open the localhost on the browser.

server is up

Congratulations! Django server is now up and you can now start coding.

Share and Enjoy !

Shares

I work hard to keep my guides up-to-date and accurate, but it is not possible for me to be perfect. Caveat lector: Do double-check with good sources any information you come across. If you do find errors, please notify me by this form.

CHECK THIS ACTIVITIES

Lorence Laudenio

Lorence is an IT grad who loves to travel. He shares tech updates, trends, and his travel journey, aiming to inspire others by blending his passions.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.