App engine create new app
Here's a step-by-step guide to creating a new App Engine app:
Prerequisites:
- You have a Google account.
- You have the Google Cloud SDK installed on your machine.
- You have Python 3.7 or later installed on your machine (if you're using Python as your runtime).
Step 1: Create a new project
- Go to the Google Cloud Console: https://console.cloud.google.com/
- Click on "Select a project" and then click on "New Project".
- Enter a project name, select an organization (if applicable), and click on "Create".
Step 2: Enable the App Engine API
- In the sidebar, click on "APIs & Services" and then click on "Dashboard".
- Search for "App Engine" and click on the result.
- Click on the "Enable" button.
Step 3: Create a new App Engine app
- In the sidebar, click on "App Engine" and then click on "Create App Engine App".
- Select the project you created in Step 1.
- Choose the runtime you want to use (e.g., Python, Java, Node.js, etc.).
- Enter a unique app ID (e.g., myapp).
- Choose the region where you want to deploy your app (e.g., us-central1).
- Click on "Create".
Step 4: Set up your app
- In the App Engine console, click on the "Navigation menu" (three horizontal lines in the top left corner) and select "App Engine".
- Click on the "App" tab and then click on "Settings".
- Set up your app's settings, such as the default language, timezone, and more.
Step 5: Create a new directory for your app
- Create a new directory for your app (e.g.,
myapp
). - Navigate to the directory in your terminal or command prompt.
Step 6: Initialize your app
- Run the following command to initialize your app:
gcloud app create --region <region> --project <project-id>
Replace
<region>
with the region you chose in Step 3, and<project-id>
with the project ID you created in Step 1.
Step 7: Create a new file structure
- Create a new directory called
app
inside your app directory. - Create a new file called
app.yaml
inside theapp
directory.
Step 8: Configure your app.yaml file
- Open the
app.yaml
file and add the following code:runtime: python37 env: flex
handlers:
- url: /.*
script: auto
This configuration tells App Engine to use Python 3.7 as the runtime and to serve requests using the `auto` handler.
Step 9: Start developing your app
- Create a new file called
main.py
inside theapp
directory. - Write your app's code in
main.py
. - Run the following command to start your app:
gcloud app run
This will start your app in the development server.
That's it! You've created a new App Engine app. You can now deploy your app to App Engine using the gcloud app deploy
command.