You can use Google App Engine to host a Web Application. Static web pages can contain client-side technologies such as HTML, CSS, and JavaScript.
- Create a new GCP Console project
- Install and then initialize the Google Cloud SDK: Click Here
This guide uses the following structure for the project: .
- app.yaml
- www/
- css/
- js/
- img/
- index.html
app.yaml
: Configure the settings of your App Engine application.www/
: Directory to store all of your static files, such as HTML, CSS, images, and JavaScript.css/
: Directory to store stylesheets.style.css
: Basic stylesheet that formats the look and feel of your site.img/
: Optional directory to store images.index.html
: An HTML file that displays content for your website.js/
: Optional directory to store JavaScript files.- Other asset directories.
The app.yaml
file is a configuration file that tells App Engine how to map URLs to your static files. In the following steps, you will add handlers that will load www/index.html
when someone visits your website, and all static files will be stored in and called from the www
directory.
app.yaml
file
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
static_files: www/index.html
upload: www/index.html
- url: /(.*)
static_files: www/\1
upload: www/(.*)
Create an HTML
file that will be served when someone navigates to the root page of your website. Store this file in your www
directory.
index.html
file
<html>
<head>
<title>Hello, world!</title>
<link rel="stylesheet" type="text/css" href="/css/style.css">
</head>
<body>
<h1>Hello, world!</h1>
<p>
This is a simple static HTML file that will be served from Google App
Engine.
</p>
</body>
</html>
Use command in GCP SDK with the dir
gcloud app deploy
gcloud app browser