Will Robohash run as a python app at App Engine? - python

We have a need for Robohashes that never change and are very secure and reliable. This is perfect for a Google app where it can be monitored, run over SSL and be extremely reliable.
I really don't have much python experience. Would someone please give a mile-high view? Would it be easy to host Robohash as a python app at the App Engine?
requirements.txt
pillow <- not supported
tornado <- looks like it will work
Are there other challenges, like say how files are accessed? Java in the appengine couldn't not read the file system last I checked it had to use resources. Do you think it will be worth-while for me to pursue?
This is the version we need: https://github.com/BitShares/Robohash

I'm afraid that won't work directly as an application deployed to the standard Google App Engine (GAE) runtime.
There is a way to add third party modules to your GAE app, and it would probably work with pillow, but not with Tornado as it would collide with the webapp2 web framework used by GAE.
Having said that, there are good news for you.
You could use Managed VMs that are in the middle of deploying only your application and of having your own virtual instance where you install everything.
With managed VMs you could build your custom runtime with exactly what you need.

Related

Golang App On Google App Engine Calling Python Scripts

I would like to build an app written in Go and host it on Google App Engine. I would like it to call some Python scripts which were written for another app (and therefore not need to rewrite that code in Go).
As far as I have seen, the Google App Engine specifies the language of the app (i.e. runtime Go in that case) but it is not clear if that app could also run some Python script. Could anyone let me know if this would be possible? If not, what would be the best process? Have a separate Python service called by the Go app - ideally I would like both services to use the same domain name?
Thanks a lot for your help!
I don't think you'll find good support for Python in the Go runtime, or vice versa.
Your best bet would be to define a custom runtime via Cloud Run -- this will have all the same serverless benefits of App Engine, but will allow you to run code in both languages in the same service.

Deployment on Google App Engine - Django, Vagrant, Ansible

I want to deploy Django project on google app engine
Following are the current situations.
I have a code on GITHUB
Djnago project has setup using Vagrant, Ansible, VirtualBox
I am completely new for cloud base deployments.
Need help to achieve this.
I checked google docs but there are couple of options for django related deployment, I am not sure which to pick for vagrant and ansible.
Your question is a bit too generic as it stands - making it here rather than comment for clarity.
If you're talking about deploying to GAE (Google App Engine) then most likely you cannot re-use your Ansible scripts as you've been writing for vagrant. As it may be possible to use Ansible to deploy on GAE, most people I know are using standard google procedure to deploy their app.
If you plan to use GCE (Google Compute Engine, a layer down in the infrastructure), you would be able to use your existing Ansible provisioning scripts (maybe with slight modification), follow along the Ansible documentation

Deploying Python on AWS Elastic Beanstalk

I'm coming from a php background and now I'd like to host a Python web application on AWS but have a few questions about it.
Do I need to use a framework like Django/Flask? Is there anyway I can use core Python to do the same? Back in php, although I tried learning Laravel in the middle, I was able to just use core php with apache and host up my website.
Tried deploying my Python code on my AWS but got an error that application.py was missing. I'd like to know, what exactly is application.py and what is it supposed to contain? Similarly, what's wsgi.py I see here and there. Are these actual files I need to create for the web app to be hosted? Is there some specific code that has to go into them or are the pre-created files by frameworks like Django, etc? Because I could hardly find too much information on them online.
I had recently tried following this tutorial from the AWS official site but to no luck.
The reason for being reluctant to use Django is the shortage of time to learn it. But if it were to make the task of hosting a Python web app easier, I would definitely look at it.
And how is the version of Python set? Because the Python codes I've written use the python3 libraries for BeautifulSoup and urllib.
I have read a lot of articles on the web but the first thing I get on searching for Python on the web or with AWS, is Django or Flask or something. How exactly does it work? When it came to php, it was simple copying the files into the /www/ folder of the server machine and I could access the website via it's url. Maybe I've read too many posts to put them all together so could someone please set it straight for me? It would be greatly appreciated!
Thanks a lot!
You will waste a lot more time trying to write a WSGI application yourself from scratch. Use a framework, it will save you a lot of time.
PHP is very different to WSGI and WSGI sits well below the level of functionality that PHP provides out of the box. PHP is more like what frameworks in Python provide. So go learn a framework. If Django seems too complicated, try Flask first.
Also don't try and do it on AWS from the outset, learn the frameworks by using the development servers they provide on your own box. Just work through their respective tutorials.
Actually AWS Elastic Beanstalk give you pure Python (2.6/2.7/3.4) with Apache + mod_wsgi as web proxy. You can look all supported Python environment in here. So, you can use any Python web framework (such as Django, Flask, etc.) in your web app. If you can, choose common and supported framework by AWS (Django/Flask).
You can think: Python + Apache + mod_wsgi is equivalent to PHP + Apache + mod_php.
Please take a look into AWS Elastic Beanstalk documentation for how to working with Python here. Read the Deploying a Django Application or Deploying a Flask Application if you choose one of them. You need to provide what Elastic Beanstalk environment (mod_wsgi) needs.
Same as PHP, Python actually only copy and paste the files. If you want to make Python web app without framework, you need to follow the WSGI standard. You can take look into this question. In my opinion, better if you use a framework, because it handles the WSGI part for you.
First of all this is a good blog post to start from if you are using Django
I don't know much about Flask, with Django once you understand the core concepts it's not hard at all.
application.py is the file that aws looks for as stated in the blog post I pointed to:
By default eb assumes our wsgi file is called application.py
this can be changed to your local wcgi.py file that Django makes when you start your project with django.
Beware that you want to use your static url correctly so aws will read them from the right folder. I personally disagree about the way the static files configuration in the post.
It's better to stay with the aws default which is "static" and just set static url in django settings to "/static/"

Can one source code be deployed to Openshift, Heroku and Google App Engine at once?

As subject, is is possible with just one source code, we can deploy our code to Openshift or Google App Engine? Heroku is not necessarily in my case.
My application is using Python Flask + PostgreSQL 9.1. I love the easiness in Openshift when I configure my technology stack, but is the case will be same with GAE?
Thanks!
I work on Openshift and at this time I'm not aware of anything that will deploy your code to GAE and Openshift at the same time.
You might be able to write your own script for it.
PostgreSQL is not available on GAE, so this code will definitely not run there.

GAE webapp alternative working outside of GAE environment

I like working with GAE environment as well as with its webapp framework. I am creating a web application using GAE environment. What I think about is how to create a version of my application that could run in another environment, like some other hosting or cloud service the easiest way. I know I will have to think about database storage alternative too and some other features that GAE gives and is not available on another platform out of the box. But now I wonder just about webapp framework. So, what can I use as alternative to this in GAE? May be some existing framework that is as much as possible close to GAE webapp? I know it is using webob, may be somebody has already implemented this alternative? Please give me some advice. Thanks!
The pre-release version of Tipfy is adding the ability to be used outside of App Engine.
Also, you might want to consider instead of finding a web framework that works in multiple environments, try out a way to run App Engine apps in other environments with something like AppScale, or TyphoonAE.
Have a look to web2py, in my opinion it's a great and well documented web framework and it offers a powerful Dal that allows your application to be portable among different types of database, GAE datastore included *.
* with some limitation explained here
I would look at Pyramid. Running Pyramid on Google App Engine
Like you mentioned, SQLAlchemy doesn't work on GAE and you won't be able to use the same data storage routines. Depending on what you are doing, you could design your application so that most everything else would be interchangeable.
Another option would be Django-nonrel. It's a version of Django that will work on app engine and is designed to make it easy to port your code from app engine to other platforms.
Running Pure Django Projects on Google App Engine
I've written a couple GAE applications, and have come to feel that Django Nonrel is a little too heavy for my tastes. I really like the ease-of-use of Flask, and I'd expect you'd feel the same way — especially for simple apps.
Here's one GAE Flask skeleton.
Here's another.
You could also check out tipfy.
There are a few projects thats are working on replicating the GAE environment:
Typhoon AE
App Scale
I have not personally used either of these but I think that would be the best place to get started.
You should check out Series about using Google App Engine with some Python web frameworks by franciscosouza

Categories

Resources