flask - Django basic use

# Imported the Flask 
from
the Flask Import the Flask

# to create applications App
= the Flask ( the __name__ )

# Create a root path view @app.route(
'/') def hello_world(): return 'Hello World!'
if __name__ == '__main__': app.run()

 

Create a django project (my version 1.11.11)

django-admin startproject mysite

cd  mysite

 The current directory will generate the mysite project directory structure is as follows:

        

  • manage.py ----- Django project inside the tool that can be called django shell and databases.
  • settings.py ---- contains the default settings of the project, including database information, debugging flags and variables other work.
  • urls.py ----- responsible for URL patterns mapped to the application.

Create an application in the mysite directory

python manage.py startapp app01

        

 

Start django project

python manage.py runserver 8080 

 

 

Guess you like

Origin www.cnblogs.com/ls1997/p/11027242.html