Python Web Development 2 Questions

1.Why do we use virtual environments? The advantage of virtual environments is avoids the effects of different Python projects,each Python project has its own library and interpreter.

virtualenv is most popular tool of Python virtual environments config.It not only support Python 2 but also Python 3,it still can designate interpreter for each virtual environment,but doesn’t inherit the basic library. From Python 3.3,there is a  buildin virtual environment called venv,it similar to  virtualenv,but it only supports Python 3.3 and the versions after Python 3.3. So,we can use command

python -m venv myenv

to create our virtual environments,actually,the file of the command is Python Root\Tools\scripts\pyvenv.py,and the official website of the venv is

https://docs.python.org/3/library/venv.html,you can take a look at it.

Why do we use Blueprints? A system has many different modules,if we put all of the code into one file,the file size will be getting bigger and bigger,more and more code, it makes the code harder to maintain. It prone to error,and difficult to find the error where.And we have to spend more time to combine the code if multiple people work on the the same file. Blueprints allows us to separate the different routes,it also has different static resources.Another words,Blueprints makes the code more loose coupling,more flexible and code reusability.It still can increases efficiency for locating the errors and reduce the error rate. Look at this websites:

http://www.pythondoc.com/flask/blueprints.html http://flask.pocoo.org/docs/0.10/blueprints/