-
Install the Google Cloud SDK.
-
Create a new project in the Google Cloud Console. When it asks you for a Project Name, please remember that the name of your project will be listed in your new website's default URL. For example, a GCloud project name of
flask-boilerplate-website
will result in a URL of https://flask-boilerplate-website.uc.r.appspot.com. Optionally, you can always purchase a new domain name, such as flask-boilerplate-website.com, and then mirror your site to the professional URL. -
After your project has finished being created (it may take a minute or two), select your new project.
-
Next, download this entire repository to your machine as a ZIP file. Open the Flask_Boilerplate_Website_Template directory in your terminal (or in GitBash if on Windows). With that folder open, run
gcloud init
, and when it prompts your for which project to select, type the number that corresponds to your new project name. Runninggcloud init
is a one-time step, so that your computer knows that the directory that you're in can be pushed to GCloud. -
Now that you've initalized your directory, run
gcloud app deploy
. Usually this is a super simple command, but this first time you run this command to deploy to a live website, it'll ask you which location you'd like to deploy to. I usually useus-central
(option number 17), because it will result in moderate speeds for anyone in the United States. If most of your users are in New York or California, then you may want to choose a more appropriate location to host your site, such as Eatsern or Western hosting zones. After selecting the locatio , then typeY
when it asks you Y or n. After typingY
, if it gives you an error, then simply rungcloud app deploy
again. Let it run for a few minutes, and then you should see a success message with the URL of your newly deployed website. -
You're done deploying! However, to update your website after you've made changes to your code, simply run
gcloud app deploy
again, followed by aY
:)
- You will most likely want to use additional Python libraries to build your website. For example, you may want to import pandas or import sqlalchemy, in which case, you'll need to add those libraries to the
requirements.txt
file. To view the version numbers of each of the python libraries that are installed on your machine, simply open your terminal/gitbash and type the commandpip list
. This shows all downloaded libraries, so you'll need to copy/paste into therequirements.txt
only the libraries needed to run your website.