![]() ![]() ![]() To test if our environment is properly set up, let’s try launching the application by entering flask run in the virtual environment. They are helpful to keep packages and dependencies separate between different projects.ĭepending on your computer’s operating system, run the following commands: Windows: A virtual environment is an isolated environment for different Python projects. Next we’re going to create a virtual environment for this project and install the required dependencies. If you ever get lost, you can view the completed project here: Flask-Postgres App Open a command line tool and run the following commands: git clone Instead of starting from scratch, let’s make a copy of the Flask app I created by cloning the Github repo. It then renders the HTML pages contained in the Template folder using the Jinja Template library. The flask application I made first makes a request to the endpoints defined in the app/routes.py file to retrieve the data that is displayed in the registration form. I’ve created an example Flask app that renders a simple registration form used to collect information from a user.įlask is one of the most popular web frameworks written in Python. In this section we're going to create the Flask app shown above. Creating a Flask App for a Registration Form Flask app example Once you have all the above installed, we can start by setting up our development environment. This is where we will deploy the flask app and connect it to a remote Postgres database. Heroku Account: You need to create a free Heroku account if you do not already have one.Python 3.6 or newer: Python installers for different versions and OS are available for download here.A Postgres Database: You need to download and install Postgres on your local computer.You will need the following to follow along the tutorial: This guide is targeted towards beginner to intermediate programmers with some familiarity with programming and using the command line. If you’ve been looking to deploy your first web app to the cloud, this is a great place to start! Technical Requirements If this is your first time working with any of these technologies, I provide a brief explanation at the beginning of each section about how each technology works. Deploying the application to Heroku (hosting the application in the cloud so anyone can use it).Setting up a Postgres database with Python (store the data from the submitted forms).Creating a Flask app (web application for submitting the form).In this tutorial, I'm going to show how to make the web app and database shown in the gif above, and how to deploy it to Heroku so it can be used by anyone.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |