In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use Flask to build a micro-film video website. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Flask . We also try to use it to build a website, this time we are building an online micro-movie video website.
Project introduction Flask introduction
Flask is a lightweight Web application framework written in Python. Its WSGI toolbox uses Werkzeug, and the template engine uses Jinja2. Flask uses BSD authorization. Flask is also called "microframework" because it uses a simple core and adds other functions with extension. Flask does not have database and form validation tools that are used by default. So compared with Django, it doesn't have a lot of features that come with the system, but on the other hand, it means that you have to implement some seemingly simple functions on your own. From this point, Flask takes more time to learn than Django.
At present, Django is generally suitable for some websites with small visits and small scale. Website managers who really have a large number of visitors will use Flask for editing, such as Fruit Shell Network, Zhizhu Network and Douban Network:
Comparison between Flask and Django,Tornado
Website introduction
The front desk includes: home page-Movie screening-Movie list-playback details-comments-favorites-search-sign-in-member Center (modify member profile, view comments, log in, collect movies)
Backstage includes: movie tags-movie management-movie trailers-website members-comments-favorites-logs-rights management-roles-administrators and so on.
The overall design framework is:
The development environment is:
Flask's rich extension
What you can learn.
And video technology:
Environment building and tools
The website is developed under the development environment of pycharm and virtualenv under windows. The specific software involved will be introduced to you next.
Installation of Pycharm
I have a previous article on the detailed installation of Pycharm, so I won't dwell on it here. Open the transmission door: Python Web technology development software installation.
Installation of virtual environment vritualenv
Similarly, I have also introduced the installation of virtualenv in 3 articles before. In order to facilitate learning, I copied it directly here!
1. Install pip
We also need to download it from Python's official website. After the download is complete, extract it to a folder (remember to put it in the same directory as Python), add environment variables (my computer, right-- > Properties, click-- > Advanced system environment settings, click-- > Advanced, click-- > Environment variables, click-- > Path under system variables) We add the address of scripts in Python at the end of PATH, and then use the CMD console to enter the decompression directory (for example: you only need to enter FRV to enter F disk on disk C and enter. Cd is used to enter a subdirectory, for example) enter the Python directory under F disk, simply enter cd Python and enter, and there is a space between cd and Python
C:\ Users\ YC-Jiang > F:
F: > cd Python
F:\ Python > cd pystall
F:\ Python\ pystall >
Then enter: python setup.py install enter and wait a few minutes.
Finally, to confirm that your pip has been successfully installed, type cmd (windows Desktop-> Quick launch-> attachment) on the command line
-> cmd. If you see anything similar running as an administrator, click OK) or enter the Windows logo + R
Pip-version
Xiaobai, please note: you need to enter a space, notice that there are two -, note that you need to execute directly on the command line instead of typing.
Execute after python (this Chinese paragraph is a reminder for you, not a statement you want to type into the terminal to execute)
If you have successfully installed pip, you will be prompted something like the following:
Pip 1.5.6 from C:\ Python35\ lib\ site-packages\ pip-1.5.6-py3.5.egg
The number after pip is the version number, and after from is the installation path of pip. What is the specific version number and path?
Everyone will be different, but as long as the computer returns a prompt like this, the pip installation is successful.
If your computer does not return a similar prompt, but has an error indicating that your pip is not defined, please refer to
This method installs pip: pip installation problems for your Windows computer
2. Install virtualenv
Enter the following command at the terminal:
Pip install virtualenv virtualenv testvir # generates cd% homepath%cd testvircd Scriptsactivate.bat # to activate pip list deactivate.bat in the current user directory (win+r% HOMEPATH% can see)
In fact, this method is quite troublesome, here I recommend a simple way to install virtualenvwrapper
3. Install virtualenvwrapper
Enter the following command at the terminal:
Pip install virtualenvwrapper-win
The next step is to create a virtual environment, again with the following command:
Mkvirtualenv movie # movie gives you the name of the new virtual environment
It creates the Envs directory under the current user directory of C:\ Users\ YC\ Envs.
You can customize and modify the directory created by mkvirtualenv: add the environment variable WORKON_HOME
Exit the active status command
Deactivate
Know what virtual environment commands are available
Workon
Direct access to the virtual environment command
Workon movie
If this happens, you have entered the virtual environment.
F:\ Envs\ movie
Again, the appearance of the previous (movie) indicates that you have entered the virtual environment, after which you can install the packages and libraries. Type pip list to view the packages that are now installed:
(movie) F:\ Envs\ movie > pip listPackage Version--pip 18.0setuptools 40.2.0wheel 0.31.1 (movie) F:\ Envs\ movie >
The next step is to install Flask, which is very similar to Django installation, except that there is one more environment check before and after installation.
Installation of Flask
Pre-installation testing: pip freeze
Install flask: pip install flask-I https://pypi.tuna.tsinghua.edu.cn/simple
Post-installation detection: pip freeze
(movie) F:\ Envs\ movie > pip listPackage Version--click 6.7Flask 1.0.2itsdangerous 0.24Jinja2 2.10MarkupSafe 1.0pip 18.0setuptools 40.2.0Werkzeug 0.14.1wheel 0.31.1 (movie) F:\ Envs\ movie > on how to build a micro-movie video website using Flask, that's all. I hope the above content can be of some help to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.