The structure of Weibo applications:
- User management, including login management, sessions, user roles, profiles and user avatars.
- Database management, including database migration processing.
- Web Forms support, including field validation and verification code features to prevent spam.
- Paging functionality for big data.
- Full-Text search.
- User Email Notification
Install the virtual environment
Self-surfing on the internet, this is not much to say, in fact, I am very annoying to install virtual environment, in their own computer is directly insert ...
Install the PY module:
Flask\scripts\pip Install Flaskflask\scripts\pip install FLASK-LOGINFLASK\SCRIPTS\PIP install Flask-openidflask\ Scripts\pip Install Flask-sqlalchemyflask\scripts\pip install SQLALCHEMY-MIGRATEFLASK\SCRIPTS\PIP Install Flask-whooshalchemyflask\scripts\pip Install Flask-wtfflask\scripts\pip Install FLASK-BABELFLASK\SCRIPTS\PIP Install Flup
Let's start our journey.
Create the structure of the program (think of what to add, the moment has not thought how to partition it ...) )
Microblog-app
__init__.py
views.py
-static
-templats
run.py
Initialize app\__init__.py
from Import = Flask (__name__)fromimport views
Writing an attempt to function
# app\views.py from Import App@app.route ('/') @app. Route ('/index') )def index (): Pass
The final step to making the Web app fully operational is to create a script that launches the application Web server we developed.
# sicroblog\run.py from Import app if __name__ " __main__ " : app.run (Debug=true)
Debug =true Open Debug mode
At this point you can run the program, open the http:\\127.0.0.1:5000 in the browser, although nothing appears, but you have succeeded in the first step
Python+mysql+flask Create a Weibo app (continuous update)