I am trying to deploy the most simple Django 1.10.5 project into Google App Engine and am completely stumped.
Upon running gcloud app deploy I am getting the following error when navigating to /...
This is the file structure of my app...
This is my .yaml file...
This is my appengine_config.py file...
I am also getting the following errors in Google Dev Tools network tab...
I am pretty certain the problem lies within my app.yaml file and am very unclear as to what url and handler are doing in this code. Can anyone see what I am doing wrong?
You seem to be quite far off from getting your django based app running on GAE. For example you're missing the lib dir where your version of django should be installed. You may want to go through Running Django on App Engine standard environment
Take a look of GAE log page and search text "raise". If you see something like "sqlite3", the problem might be caused by the default content of DATABASES section in settings.py file. Commenting out this DATABASES section solved my problem("Error: Server Error" only when deployed to GAE; working fine locally).
Related
I have a working python 3.9 Flask app. The latest Pycharm is my IDE. Yesterday I created a new app with a very similar structure. The old app runs and finds/loads all static content just as expected when run through the PyCharm debugger or from the command line with flask run.
The new app will "run" from PyCharm or flask run. It loads the main/home blueprint and serves the correct template. What it does not do is serve any css or js resources in the static folder. Rather, it tries to load them but each resource in the Brave developer tools window has the message:
Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH
I have surveyed the file sizes for each css and js file. I have matched the lengths against the developer tools "network" tab response information and it looks like all the sizes match.
I have tried this with FireFox and it just says:
Loading failed for the <script> with source “http://127.0.0.1:5000/static/LIB/jquery/jquery.min.js”.
and the other resources.
I have deleted and recreated the node_modules and the .idea dirs.
Ideas?
Sigh, my problem was with setting the USE_X_SENDFILE Flask config variable. The dev server does not support it and honestly I don't know why I even included it. Removing it fixed my issues.
Thanks entirely to this post:
Flask development server with X-Sendfile
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
This is my first web app I've ever developed, so even though I thoroughly searched everything I could for the Google App Engine, I'm afraid that my terminology and Google fu simply isn't good enough for what I need.
When I open up my terminal and type "python main.py", I can see that it works correctly on localhost.
Now I am trying to host this application on the Google App Engine. I have spent hours watching Youtube tutorials and following setup guides, trying to emulate their file structure and file contents. Whenever I deploy my app, I get the "500- Server Error: The server encountered an error and could not complete your request."
Here is my code: https://github.com/csherrod5/csherrod5.github.io
Here is an example of the types of guides I've been following: https://medium.freecodecamp.org/how-to-build-a-web-app-using-pythons-flask-and-google-app-engine-52b1bb82b221
I'm hoping someone is kind enough to help me diagnose my problem.
Thank you to everyone who stops by
There's no lib folder in your application directory, so App Engine won't have any of the third party libraries you're trying to import.
You've correctly added the appengine_config.py file needed to vendorise third-party libraries, but you need to add the libraries you want to use to a 'lib' folder in your application directory.
Some of the libraries you want to use are built into the runtime, you just have to add them to your app.yaml to use them.
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.
I've downloaded google_appengine version 1.3.1. Using some web tutorials, I've created basic django 1.1.1 application. Using appcfg I managed to deploy it on GAE and it works. The problem is, that application doesn't want to work on dev_appengine.py developement server.
Whenever I run the app GAE local server is returning HTTP 200 without any content. If I set basic environement and run main.py manually, then the page is properly returned on stdout.
I've also created very basic helloworld application, and this one is working ok on the devel server.
Do you have any idea, how can I debug the devel server? Option -d doesn't give any usefull insight at all.
I had module nammed same way as the default GAE launcher (main/ and main.py). After renaming the launcher everything works great.