Technology

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

Last updated on May 29th, 2023 at 10:04 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

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

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

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

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

We put a lot of effort into making sure our travel guides and information are as up-to-date and accurate as we can. But, just so you know, we can't promise that everything on our site is absolutely correct or the very latest all the time. It's a good idea to double-check things with sources you trust. If you happen to spot something that's not quite right, please give us a heads-up using this form. Your feedback is super valuable and helps us make our guides even better.

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

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