System: Mac osx10.10.3, Django version: 1.8.1
1. Under terminal Enter the destination folder, run Django-admin startproject projectname. After the command finishes running, a project named ProjectName is created under the current directory. The project contains a folder with the same name (ProjectName) and a manage.py file. Subfolders projectname contain files such as Profiles settings.py and urls.py.
2. After entering the ProjectName project, run the Python manage.py startapp appname command. After execution, an app named AppName is created in the current project.
3. Open the settings.py file mentioned in the first step, locate the Installed_apps configuration, and add the appname.
4. Add the folder templates under the AppName app and create the app's Web page under this folder, such as Index.html. The following is an example of index.html.
5. Add the method func that handles the index.html request in the appname views.py file.
6. Add the URL (r ' ^index ', func) in the urlpatterns of the urls.py file mentioned in the first step. The func here is the same method as the Func method in the views.py file.
In this way, a simple application is completed. Exit to the project Ask folder, execute Python manag.py runserver run the local server. Then enter the URL http://127.0.0.1:8000/index on it.
Start a Django Project