How do I use web2py on Heroku? - python

I'm having a lot of trouble with getting web2py to work on Heroku. I can't even get a basic app to work. Whenever I go to my herokuapp page, it says
Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details."

It may be a problem with the DB setup. By default web2py only supports sqlite or Google App Engine (GAE). It's probably trying to initialize sqlite databases on Heroku's read-only filesystem.
Either disable the DB code temporarily to see if this is indeed the case, or configure a connection to a supported database (MySQL, S3, etc).

Take a look at the "official" Heroku script in scripts/setup-web2py-heroku.sh

Try with a simple wsgi application first. Here is some tutorial: http://webpython.codepoint.net/wsgi_tutorial
Web2py will work without any problems if you can run simple wsgi apps.

Related

Use an external database in Django app on Heroku

I am trying to deploy a Django REST API on Heroku. Normally I wouldn't have any issues with this but for this app, I am using a legacy database that exists on AWS. Is it possible for me to continue to use this remote database after deploying Django to Heroku? I have the database credentials all set up in settings.py so I would assume that it should work but I am not sure.
It should not pose any problem to connect with an database on AWS.
But be sure that the database on AWS is configured to accept external access, so that Heroku can connect.
And I would sugest that you take the credentials out of the source code and put it in the Config Vars that Heroku provide (environment variables).
Will it work? I think yes, provided you configure your project and database for external access.
Should you want it? How may queries does an average page execute? Some applications may make tens of queries for every endpoint and added wait can combine into seconds of waiting for every request.

Uploading Django app to Python anywhere

I'm currently trying to upload my django app to pythonanywhere and i keep running into errors with my wsgi application, it says "sys" is not defined. I have correctly followed all the steps in the manual that pythonanywhere provides, yet it is still not working. I want to know if anyone has successfully uploaded a django app with pythonanywhere and how he/she got it done; or if there are better alternatives i can explore. Thanks. I would be waiting for an answer.
Pythonanywhere advice to set up a virtual environment, in which you install all dependancies. Have you done so?

Django: Push app from local server to production server via FTP

This is a bit embarassing, but I'm a Django noob and I couldn't find a simple solution to this:
I have written a Django app in a local VM that I now want to deploy to a "production" server. App works like a charm locally.
Now my IT colleague has set up the server with Django and that also works fine. I can open it via the Web and I get the usual "Congratulations on your first Django-powered page". I can also log into the admin interface. The project has been created.
This is a very low-key mini project and I'm not too familiar with git, so we've decided to just push files via FTP. (And I want to stick with that if at all possible.) So I uploaded the app folder into the project folder and also adjusted the project's settings.py and urls.py.
However, nothing seems to be happening on the server's end. The welcome page is the same, the app does not show up in the admin interface and the URLs won't be resolved as hoped.
Any suggestions what I should have done / done differently?
You need to restart apache or whatever is running your django project. Your changes to py files are cached when you first load your server config (settings).
Any suggestions what I should have done / done differently?
You should be using git/jenkins/deployment techniques, I know you said you've decided not to use it but you're going to be missing out on important things like being able to keep track of changes and unit testing

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.

How To See A Database On Heroku

How do I see the database for my heroku web app?
I just want to verify if users are being registered, properly, etc.
I am using Flask-SQLAlchemy Python, if that makes a difference.
You can connect directly to it using something like PGAdmin, look at the output of heroku config for your application to get your database URL which you can breakup to use in GUI tools.

Categories

Resources