I. Pycharm in the installation of Django
(This tutorial defaults you to having Python 3.7.6 installed and configured)
—>Settings
Second, build Django project
—>New Project
2. A new window will open and the following file will appear
Explain these files briefly:
**init.py:** This is an empty file for initialization, usually we don't need to touch it.
: This is a configuration file with information about the language, time zone, installed app declarations, and so on;
: This file specifies the mapping of views, etc. to be called when accessing a page, ensuring that you can correctly locate the functionality you want to implement when accessing it;
: This is a wsgi related configuration for the web program, we don't need to modify it for now.
: It can be understood that he is the control center of the django application, the implementation of many commands, need him to mobilize.
3. Create an APP in the project
Use Pycharm's Terminal console to create the
python startapp DjangoWeb
4. Configure relevant files
(1) Modify DjangoWeb/
file, is a view file, we want to display the Hello Django and other content to be realized in this file. Add the following code to the file:
from import HttpResponse def index(request): return HttpResponse('Hello Django')
(2) Modify DjangoTest1/
Find the variable INSTALLED_APPS in this file and add it at the end:'DjangoWeb', # Name of the App
(3) Configure DjangoTest1/
Open the file and add the following code:
from import admin from import path from DjangoWeb import views urlpatterns = [ path('admin/', ), path('index/', ) ]
(4) Starting services
In the pyCharm Terminal console, execute:
python runserver
appears after the carriage return is executed:
Click on the consolehttp://127.0.0.1:8000/
Or copy and paste it into your browser to open it and it appears:
Add indexhttp://127.0.0.1:8000/index
, appeared:
III. Subsections
There are many different web frameworks under Python, and Django is one of the most iconic of the heavyweights. Many successful websites and apps are based on Django.
Django is an open source web application framework written in Python.
Django uses the MVT software design pattern, i.e. Model, View and Template.
to this article on the use of Pycharm + Django to build a simple Python Web project steps to this article, more related Pycharm + Django to build Python Web project content, please search for my previous posts or continue to browse the following related articles I hope you will support me in the future!