Joe Lowery
Joe Lowery

Reputation: 572

Deploy Python on Compute Engine

I'm trying to figure out how to deploy a Python app to Google Cloud Compute Engine. I'm just getting my feet wet and working with their Getting Started tutorial here: https://cloud.google.com/compute/docs/api/python-guide#gettingstarted.

I'm beginning to grasp the code, but I'm totally in the dark how to deploy the script so I can run it in my Compute Engine project. Would I use the gcloud compute copy-files command? If so, where do I move the files to?

Sorry for the more general question; I hope someone can help me get over this hurdle or maybe point me to a resource.

TIA - Joe

Upvotes: 1

Views: 1369

Answers (2)

Joe Lowery
Joe Lowery

Reputation: 572

After a lot of research and some help from a Python-savvy friend, I realized that CE has the ability to allow such an app to run from your own command line; it's unnecessary to deploy the files to another server. The key is to set up a Client ID for an installed application and then choose Other from the available types. This will generate a JSON file that can be downloaded and used in your request.

Hope this helps someone else - Joe

Upvotes: 1

chrispomeroy
chrispomeroy

Reputation: 820

The tutorial you linked to is to demonstrate how to control/orchestrate GCE resources (create, delete, modify servers, etc.) using Python code and the GCE Python client library. Is this what you're looking to do?

If you just want to set up a sample python application running on GCE, you might want to check out Django. Python is already included on the Linux distributions you can use on GCE, and you can also use the pre-installed database SQLite, so all you need to install is the Django framework to get started.

Then, to develop your app locally and deploy it on GCE, you can just use git. Install git locally and on the GCE instance, push your changes to the GCE instance, then use git pull on the GCE instance (once you're ssh'd in) to deploy and run the app on the instance.

https://docs.djangoproject.com/en/dev/intro/install/

Upvotes: 0

Related Questions