I am attempting to run handler unit tests on my Google App Engine Application using WebTest, however, my application uses vendor.add("lib") in appengine_config.py in order to import libraries that I use throughout the app.
I'm having trouble running my unit tests because webtest seems to not be able to find and import these repos, since they are part of the app's structure and webtest is only emulating one set of it's routes.
Anyone have any ideas on how to solve this? Any way for webtest to recognize the libs? Thanks!!
Related
I have a Flask app running in Google Cloud App Engine. I want the user to be able to call MATLAB functions on their local instance - if they have MATLAB installed locally and the correct license, of course.
Running locally the app works well using matlab.engine, however, when deployed to google cloud platform it fails during build. Looking in the logs:
ModuleNotFoundError: No module named 'matlabengineforpython3_7
So I suspect it is because the server cannot import the required dlls etc. for the python matlab engine package to work.
Is there a way to pass the required files to google app engine? Is this approach even possible?
My users will always have a local copy of MATLAB, so I am trying to find a solution that avoids needing to pay for the MATLAB server license.
I don't believe that any solution is possible that would avoid a Matlab server license. Your server cannot access installed Matlab on the computers of your users.
To install non-Python software with App Engine you need to use a custom runtime with App Engine Flexible. Check the GAE docs for more details.
I followed this Large Flask Applications tutorial and changed my main.py into __init__.py. Now, running the app locally uses flask run instead of python main.py.
The problem: when I deploy the app, I get a 502 Bad Gateway error obviously. I know that, by default, App Engine will look for the main.py file as an entry point.
But now that the entry point has changed, what can I do?
Can Google App Engine work with large Flask apps?
As per the documentation The Python Runtime, you can change the entrypoint value in the app.yaml file, so it would redirect your __init__.py file.
Besides that, I would recommend you to take a look at the following links, where there is more information, regarding building and developing an application with Python and Flask.
Building a Python 3.7 App on App Engine
Python App Engine 2017: Building a simple Flask app
These links should provide a good overview of development with these two applications, which should cover how to avoid such errors that you are facing.
Let me know if the information helped you!
I have a web application which uses Flask and talks to a database at the backend. It also uses Amazon AWS S3. I have written unit tests for this package.
The question is that I want to write integration tests where I am testing the external dependencies as well. I have been reading about integration tests and system tests. Do I create a new package lets says FooSystemTests or FooIntegrationTests or should they be part of my application package? I am planning to make this as part of my deployment process. My plan was in the integration tests I will test my external dependencies and in the system tests I will test things like if I go to a route what do I get back (testing as if the system is a black box). Also I read about selenium testing, where should that be system or integration?
Any thoughts/ideas will be very helpful.
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.
Is there a common/best practice way to build a client-side javascript test platform for GAE python?
I know the GAE SDK has a Testbed API, and there's nose-gae. Both of these seem to be designed for unit-testing of server side code. I'm currently running on django-nonrel, and using django's unit test framework for this.
I'm looking for a similar testing framework where I can load fixture data, but run a real HTTP server so I can run Selenium tests against the server. This way I can test my javascript AJAX calls against fixed data.
I'm currrently achieving this by having django's test framework launch the GAE SDK dev_appserver on a separate thread after loading fixtures. This is able to handle HTTP calls from a browser. It mostly works for me, but there's a few cases where there's some flaky threading issues. The worst part is that it's rather hacky and calls deep into the SDK to launch dev_appserver. This is going to break with dev_appserver2.
I'm wondering if there's a better way to solve this. With all the GAE devs out there, someone else must be running system tests against fixed data?