Create a Django Program
Terminal command: Django-admin startproject sitename
When the IDE creates a Django program, it is essentially automating the above command
The above SiteName is the name of the project you define!
Other common commands:
Python manage.py runserver 0.0.0.0:port python manage.py startapp appname python manage.py syncdb python manage.py make Migrations python manage.py migrate python manage.py createsuperuser
settings.py Placement Profile
urls.py Storage Routing System (map)
wsgi.py let you do configuration: Wsgi has a multiple of a uwsgi and WSGI, you use that kind of wsgi to run Django, generally do not have to change only when you use
Manage.py is the Django startup hypervisor.
Above configuration file, if it is a beginner do not modify after the creation of project, because it involves a lot of configuration files need to be modified
Project and App Concepts
We are currently creating a project,project below can have a lot of apps, what is the principle of it!
The project we created is a big project, and there are a lot of features: (a project has multiple apps, in fact he's a sort of big project for You)
"Project --web (foreground function) --administrator (background management function) a project has multiple apps, but he's a sort of" ' "for your big project.
Create an App
Python manage.py Startapp App01
If you are creating an app, we can understand that the app is completely independent of the app in the phone, and the benefit is to reduce the coupling between them, and not to let them build relationships!
The admin inside the app is the platform that provides the background management, test is used for testing!
Admin Background Management:
Synchronizing databases
Python manage.py syncdb #注意: Django 1.7.1 and above need to use the following command Python manage.py makemigrationspython manage.py Migrate
Create Super User
Python manage.py Createsuperuser
Enter the username and password you want to set, then start Django and enter Rul/admin: http://127.0.0.1:8000/admin/