I am new to Google App Engine and just deployed a sample project "flask" to my GAE. But it shows
"Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds."
I have read a lot of similar questions on stackoverflow, but I don't find any who has this problem even for the sample project provided by GAE itself.
I just ran into this issue and found the answer in the sample project README file. The problem was that flask isn't included in the sample project, so I was getting an flask import error. You just have to cd to your project directory (appengine-flask-skeleton-master) and run the following...
pip install -r requirements.txt -t lib
If you are on linux you will probably need to include sudo before the command.
You should now see flask in the lib folder in the sample project directory. If you update your project again, the import error should be resolved.
You can test your app locally by running:
dev_appserver.py .
Hope that helps.
Related
My django app deployed in heroku managed to show upload file form. However once I try uploading Excel xlsx file, it shows
UnknownParameters at /
Please check if there were typos in function parameters: {'model': None, 'initializer': None, 'mapdict': None}.
Otherwise unrecognized parameters were given.
Following installation setup has done for django-excel
requirements.txt
pyinstaller
django-excel
pyexcel-xls
pyexcel-xlsx
pyexcel-ods
I am sure that my models.py is connected and along with the mapdict parameters matches correctly
I've seen similar issue Why pyexcel throws exception "UnknownParameters: Please check if there were typos in function parameters"? and I tried installing pyinstaller along with hidden imports
--hidden-import pyexcel_xls
--hidden-import pyexcel_xls.xlsr
--hidden-import pyexcel_xls.xlsw
but unfortunately it still doesn't work for my app
I wonder if there is any clue to solve this for me to run my django web application on heroku? or any advice or learning for hidden-import to run within heroku web app?
I recommend hosting your django app in pythonanywhere.com
With a little bit of search I found that people is having problem with the library you are using for excel files when deploying in heroku, maybe heroku can't support pyexcel.
Here is a tutorial of how to deploy your app in pythonanywhere https://www.youtube.com/watch?v=Y4c4ickks2A
After I tried to deploy my Django website on Azure, I got an error saying:
ModuleNotFoundError: No module named 'django'
I added a requirements.txt in the root directory of my Django project, am I missing anything else? I've tried to install Django from Kudu BASH but it gets stuck on "Cleaning Up".
Here is the full error: https://pastebin.com/z5xxqM08
I built the site using Django-2.2 and Python 3.6.8.
Just summarized as an answer for other people. According to your error information, I can see that you tried to deploy your Django app to Azure WebApp on Linux based on Docker. So there are two offical documents will help as below.
Quickstart: Create a Python app in Azure App Service on Linux
Configure a Linux Python app for Azure App Service
The error ModuleNotFoundError: No module named 'django' indicated that there is not django package installed on the container of Azure Linux WebApp.
Due to the content of Container characteristics of #2 document above as below,
To install additional packages, such as Django, create a requirements.txt file in the root of your project using pip freeze > requirements.txt. Then, publish your project to App Service using Git deployment, which automatically runs pip install -r requirements.txt in the container to install your app's dependencies.
So the possible reason is the requirements.txt file not in the corrent path of your project or container after deployed, which path should be /home/site/wwwroot/requirements.txt on the container or the root of your project like the offical sample Azure-Samples/djangoapp on GitHub.
I had the same problem. requirements.txt was in my repository, but randomly I started getting the same error ModuleNotFoundError: No module named 'django' after changing a setting or restarting the service or something. Nothing I could do, change the setting, or reboot repeatedly fixed it. Finally what worked for me was this:
Make a small change to the code and commit it, and push it up to the app service.
This fixed it for me. It has happened a couple times now and every time this solution has worked for me. It seems like the App Service sometimes gets in this state and needs to be jostled with this trick?
Iv'e been doing some maintenance on the server side and then deployed the app to the GAE. since I deployed the new version, it doesn't recognize the flask_sqlalchemy module. It worked perfectly before the commit. is there something that I'm missing?
Ok for anyone getting this error, apparently I forgot to copy the libraries to the lib folder. I did that by using the command: pip install -t lib -r requirements.txt
My Python app needs web.py to run but I'm unable to figure out how to get it up to bluemix. I see no options using cf push. I tried to "import web" and added some additional code to my app without success.
When I push my Python app to bluemix without web.py it fails (naturally) since it does not have what it needs to run.
I'm sure I'm just missing an import mechanism. Any help?
I recommend that you try out this starter template on GitHub. It is enabled with a deploy to Bluemix button that automatically creates a python runtime and postgress database with Django installed. https://github.com/fe01134/djangobluemix
The project includes the requirements.txt file to ensure you have the right dependencies and also the .settings file to read the database user id and password from VCAP Services. It also leverages Declared services in the manifest file to create a database service for you.
Here is a YouTube Tutorial on how to deploy Python app on Bluemix https://www.youtube.com/watch?v=qIcHQQNUmlE&list=PLvsG7O_a5F2dAjsNp6aRACP6vkqdgsZ33&index=5
The cause for this problem was that I was not correctly telling my Python app the needed configuration information when I pushed it out to Bluemix.
What I ended up having to do was add a requirements.txt file and a Procfile file into the root directory of my Python application, to draw that connection between my Python app and the needed libraries/packages.
In the requirements.txt file I specified the library packages needed by my Python app. These are the file contents:
web.py==0.37
wsgiref==0.1.2
where web.py==0.37 is the version of the web.py library that will be downloaded, and wsgiref==0.1.2 is the version of the web server gateway interface that is needed by the version of web.py I am using.
My Procfile contains the following information:
web: python .py $PORT
where myappname is the name of my Python app, and $PORT is the port number that my Python app uses to receive requests.
I found out too that $PORT is optional because when I did not specify $PORT my app ran with the port number under the VCAP_APP_PORT environment variable for my app.
From there it was just a matter of pushing my app out to Bluemix again only this time it ran fine.
just use pip freeze
pip freeze > requirements.txt
add the requirements.txt to your project
when deployed it will automaticly install the dependency
I am following getting started guide of google app engine python2.7. I have downloaded zip file of app engine for my ubuntu. I have created helloworld files and ran
'google_appengine/dev_appserver.py helloworld/'
command. localhost:8000, i.e. admin page opens fine, but localhost:8080 has server error.
I have tried to import in my local python environment, which gave an error. So do we have to install it? which I tried according to webapp2's official website but didn't work out.
This question gets asked so many times, have you checked stackoverflow for similar answers?
Have you read the documentation on what third party libraries are included with the appengine runtime.
webapp2 is included in the runtime but you must configure support/inclusion in app.yaml
https://developers.google.com/appengine/docs/python/tools/libraries27
And before you get any further read up on how to include external third party libraries. You will save yourself lots of time and questions just reading.