(The environment can always be created from requirements.txt.) You create the virtual environment shortly to make sure it's excluded from source control. Select the option I will install them myself. (Select Show required packages to see the exact dependencies.) This dialog appears because the template includes a requirements.txt file referencing the latest Flask 1.x package. If you don't see this option, run the Visual Studio installer and add the Git for Windows and GitHub Extension for Visual Studio on the Individual components tab under Code tools.Īfter a moment, Visual Studio prompts you with a dialog saying This project requires external packages (shown below). Create new Git repository: Select this option (which is clear by default) so that Visual Studio creates a local Git repository when it creates the solution.Create directory for solution: Leave set (the default).Solution name: set to LearningFlask, which is appropriate for the solution as a container for multiple projects in this tutorial.Location: specify a location in which to create the Visual Studio solution and project.This name is also used for the Flask project. Name: set the name of the Visual Studio project to BasicProject.In the fields at the bottom of the dialog, enter the following information (as shown in the previous graphic), then select OK: (The template is also found under Python > Web in the left-hand list.) In Visual Studio, select File > New > Project, search for "Flask", and select the Blank Flask Web Project template. ![]() By keeping the projects in the same solution, you can easily switch back and forth between different files for comparison. You create the project using different Flask project templates that are included with Visual Studio. Over the course of these steps you create a single Visual Studio solution that contains two separate projects. Use the Flask Web Project template to create an app with multiple pages and responsive design (step 4).Serve static files, add pages, and use template inheritance (step 3).Create a Flask app with one page and render that page using a template (step 2).Create a basic Flask project in a Git repository using the "Blank Flask Web Project" template (step 1).Templating is provided by extensions such as Jinja and Jade, as demonstrated in this tutorial. For example, Flask itself doesn't provide a page template engine. ![]() The extensions integrate seamlessly with Flask so that they appear as if they're part of Flask itself. Such features are instead provided by special Python packages called Flask extensions. Applies to: Visual Studio Visual Studio for Mac Visual Studio Codeįlask is a lightweight Python framework for web applications that provides the basics for URL routing and page rendering.įlask is called a "micro" framework because it doesn't directly provide features like form validation, database abstraction, authentication, and so on.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |