fbpx

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

django server running

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.

What’s your Reaction?
+1
0
+1
0
+1
1
+1
0
+1
0

Leave a Reply

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

%d bloggers like this: