python --version
If missing or wrong version, install from https://www.python.org/downloads/ and add to your path.
- Verify that
virtualenv
is installed:
virtualenv --help
- If it is not installed, installed it with
pip
:
pip install virtualenv
- Create the virtual environment
venv
virtualenv venv
- Activate the virtual environment
- Windows DOS command:
venv\scripts\activate.bat
- Windows Powershell:
venv\scripts\activate.ps1
- Bash:
source venv/bin/activate
- Windows DOS command:
pip install -r requirements.txt
From command line (DOS, Powershell, bash):
python main.py
- Install Python extension:
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter
ext install python
- Read extension documentation and particular, the documentation about linting.
To let Visual Studio code find the correct python interpreter and libraries for debugging and intellisense.
- From the command line (with virtual environment activated): environment picked automatically
vscode .
- When opening Visual Studio Code from file explorer (Open with Code menu):
Set the environment from the command palette:
Ctrl+Shift+P
Choose thepython select workspace interpreter
python
executable under your localvenv
directory.
Like Visual Studio, press F9
to set a break point, F5
to start debugging
There are diffent ways to debug Flask.
This example is setup for Flask debugging solution 2.
gcloud config list
** Windows setup is different from Linux/Mac**
- In appengine_config.py
- Mac/Linux
vendor.add('venv/lib/python2.7/site-packages')
- Windows
vendor.add('venv/Lib/site-packages')
- In app.std.yaml
- Mac/Linux
skip_files: - (venv/lib/python2.7/site-packages/appengine_sdk.*) - (venv/lib/python2.7/site-packages/setuptools/.*) - (venv/lib/python2.7/site-packages/nose.*) - (venv/lib/python2.7/site-packages/pip.*)
- Windows
skip_files: - (venv/Lib/site-packages/appengine_sdk.*) - (venv/Lib/site-packages/setuptools/.*) - (venv/Lib/site-packages/nose.*) - (venv/Lib/site-packages/pip.*)
gcloud app deploy --version=v1 app.std.yaml
- Service:
https://talk-demo-dot-<projectname>.appspot.com
- You can also use
gcloud app browse -s talk-demo
- You can also use
- default:
https://<projectname>.appspot.com
- You can also use
gcloud app browse
- You can also use
gcloud beta emulators datastore start &
`gcloud beta emulators datastore env-init`
# emulators - start
gcloud beta emulators pubsub start &
`gcloud beta emulators pubsub env-init`
# emulators - kill
pkill -f emulators
unset PUBSUB_EMULATOR_HOST