flask windows
时间: 2023-10-26 21:42:56 浏览: 84
Flask is a popular Python web framework used to build web applications. It is lightweight and easy to use, making it a popular choice for beginners and experienced developers alike. Flask can be installed on Windows by following these steps:
1. Install Python: Flask requires Python to be installed on your system. Download the latest version of Python from the official website and install it on your Windows machine.
2. Install pip: Pip is a package manager for Python that allows you to easily install and manage dependencies for your project. To install pip, download the get-pip.py script from the official website and run it using the following command:
python get-pip.py
3. Install Flask: Once pip is installed, you can use it to install Flask using the following command:
pip install Flask
4. Create a Flask project: After installing Flask, you can create a new Flask project by creating a new directory and creating a Python file with the following code:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
if __name__ == '__main__':
app.run()
5. Run the Flask app: To run the Flask app, navigate to the project directory and run the Python file using the following command:
python app.py
This will start the Flask development server and you can view the app by navigating to http://localhost:5000 in your web browser.
阅读全文