[PYTHON] How to use App Engine's local development server dev_appserver.py

Frequently used options on App Engine's local development server dev_appserver.py.

Start normally.

$ dev_appserver.py app.yaml

Check with http: // localhost: 8080. The management console is http: // localhost: 8000.

Start by specifying the datastore storage directory.

Do not mix when developing while switching between multiple projects.

$ dev_appserver.py --datastore_path=.datastore app.yaml

If the directory name starts with. (Dot), it will be skipped during deployment. You can specify it explicitly with skip_files: in app.yaml.

Start by specifying the port number of the local host.

When you want to start multiple dev_appserver.py, such as when developing multiple projects in parallel.

$ dev_appserver.py --port=8081 --admin_port=8001 --datastore_path=.datastore app.yaml

Start with Docker container.

Get the official image. For the lightest Alpine linux.

$ docker pull google/cloud-sdk:alpine

Dockerfile.

FROM google/cloud-sdk:alpine

MAINTAINER syousei

RUN gcloud components install app-engine-python

RUN mkdir /app_source
VOLUME /app_source

EXPOSE 8000:8000 8080:8080

Build.

$ docker build -t syousei/appengine-python:alpine .

If you want to be able to use the gcloud command from inside the Docker container, pass authentication. When you type this command, open the URL displayed in your browser, and when the authentication token is displayed, type it to authenticate.

$ docker run -ti --name [DOCKER CONTAINER NAME] syousei/appengine-python:alpine gcloud auth login

Run

$ docker run -it -v C:\Projects\[PROJECT NAME]\app_source:/app_source -p 8080:8080 -p 8000:8000 --name=[DOCKER CONTAINER NAME] syousei/appengine-python:alpine

Start dev_appserver.py.

$ docker exec -itd [DOCKER CONTAINER NAME] dev_appserver.py --host 0.0.0.0 --admin_host 0.0.0.0 --datastore_path=/tmp/datastore /app_source/app_dev.yaml

that's all.

Recommended Posts

How to use App Engine's local development server dev_appserver.py
How to set up a local development server
How to use xml.etree.ElementTree
How to use virtualenv
How to use Seaboan
How to use image-match
How to use shogun
How to use Pandas 2
How to use Virtualenv
How to use numpy.vectorize
How to use pytest_report_header
How to use partial
How to use Bio.Phylo
How to use SymPy
How to use x-means
How to use WikiExtractor.py
How to use IPython
How to use virtualenv
How to use Matplotlib
How to use iptables
How to use numpy
How to use TokyoTechFes2015
How to use venv
How to use dictionary {}
How to use Pyenv
How to use list []
How to use python-kabusapi
How to use OptParse
How to use return
How to use dotenv
How to use pyenv-virtualenv
How to use Go.mod
How to use imutils
How to use import
How to use jupyter lab in Windows 10 local environment
How to use Django on Google App Engine / Python
How to use search sorted
[gensim] How to use Doc2Vec
Understand how to use django-filter
How to use the generator
[Python] How to use list 1
How to use FastAPI ③ OpenAPI
How to use Python argparse
How to use IPython Notebook
How to use Pandas Rolling
[Note] How to use virtualenv
How to use redis-py Dictionaries
Python: How to use pydub
[Python] How to use checkio
[Go] How to use "... (3 periods)"
How to use Django's GeoIp2
[Python] How to use input ()
How to use the decorator
[Introduction] How to use open3d
How to use Python lambda
How to use Jupyter Notebook
[Python] How to use virtualenv
python3: How to use bottle (3)
python3: How to use bottle
How to use Google Colaboratory
How to use Python bytes