python django is doing the back-end web framework most powerful and versatile, not as a python django of salted fish. . . So start learning django framework.
The first choice was to download django in python
Download Command:
PIP install Django
Normal download as shown below:
django downloaded Well, a lot of small partners do not know where to find the downloaded django, do not worry me step by step
First enter python
kouhuideAir:~ kouhui$ python3 Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 05:52:31) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path ['', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6 ' , ' /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload ' , ' / Library / Frameworks /Python.framework/Versions/3.6/lib/python3.6/site-packages ' ] kouhuideAir: ~ $ CD /Library/Frameworks/Python.framework/ kouhui the Versions kouhuideAir: $ LS kouhui the Versions 3.6 kouhuideAir: Open the Versions kouhui $ 3.6
Open python3.6 will see this folder, then you can see it is just great django
Create a folder on your computer pro, into the project directory, and now we can start the project first django
kouhuideAir: ~ $ kouhui CD / the Users / kouhui / Desktop / Pro /
kouhuideAir: Pro kouhui $ Django -admin.py startproject my_first_django
You just new django project at this time your folder will appear in the directory structure as shown below:
Here is the entire manager.py django project startup file
django settings.py entire project profile
url is urls.py django project the entire controller, a function to allocate a corresponding view according to the client request url
wsgi.py will be sent to the deployment
Then we create the first django inside the first application of the project
kouhuideAir:pro kouhui$ cd my_first_django/
kouhuideAir:my_first_django kouhui$ ls
manage.py my_first_django
kouhuideAir:my_first_django kouhui$ python3 manage.py startapp my_first_pro
kouhuideAir:my_first_django kouhui$
Enter the project, the implementation of the project on the application manager.py file generated at this time
models.py file is mainly used to operate the database application projects
views.py files sent by the client for processing the url
Finally, start the application project on ok
kouhuideAir:my_first_django kouhui$ python3 manage.py runserver Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run 'python manage.py migrate' to apply them. June 30, 2019 - 10:59:18 Django version 2.2.2, using settings 'my_first_django.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C.
此时应用项目就启动了,应该启动时没有输入ip地址和端口号,默认为127.0.0.1:8000,在网址中输入127.0.0.1:8000,第一个diango项目启动好了!!!
请尊重作者劳动成果,有需要请转载,标明出处!!!