Wagtail Heroku Hosting Deployment - python

I am trying to deploy my wagtail app to Heroku but I have run into an issue that I do not understand.
My backend admin works perfectly
https://idealbackend01.herokuapp.com/admin
But my front end says an internal server error
https://idealbackend01.herokuapp.com/
I followed this approach and used whitenoise for static storage.
https://github.com/CodingForEverybody/wagtail-heroku-deployment/blob/master/README.md
Then I got s3 connected following this for media files this works as I was able to upload a file to my s3 bucket.
https://wagtail.io/blog/amazon-s3-for-media-files/
During my Heroku build, I didn't get any errors, and there were no issues in the logs.
Ask I said the backend renders fine and everything works as expected, but nothing on the front end seems to be working.
Is this possibly due to the sites hostname and port? It is currently set at localhost and 80
Then I tried to set it to my default URL https://idealbackend01.herokuapp.com/ but neither solution seems to be fixing the front end issue.
Is there a reason the admin would not be loading but the frontend wouldn't.
Any direction you can provide would be much appreciated.

Related

502 bad gateway with supervisor but not with gunicorn

I am setting up a test server at home. The web app is built with flask and python 3.6. For setting up the web server with nginx and gunicorn I followed the guide Real Python Tutorial. This use supervisor for the final management engine.
The problem is I don't know where to start looking to find the cause of my issue. The app has a file upload form which when submitted gets 502 bad gateway if the server is start with supervisor. But if you start gunicorn directly the app works with no issues and uploads the files as expected.
Any help on how to debug this would be great. I don't know what information to share so just ask and I will get what ever you if I can. The server is Ubuntu 16.04.
I spent some days with a similar issue, but with a Django app. Basically, the Bad Gateway problems with Nginx have to do with permission issues for the connection between Nginx and Gunicorn. I suggest you look at your nginx.conf file, and check the user used. The user must be the one that administrates the system (have the necessary permisions for executing/reading). Also, check that you include the configuration files contained in sites-enabled/ (in my case I don't have this directory, but directly overwrote the nginx.conf file). Then, check that you have the #proxy_to_app, location / , and upstream blocks like explained here https://rukbottoland.com/blog/django-gunicorn-nginx-supervisor/
Hope this helps!
Tip: check the nginx logs at /var/log/nginx/ for any error message. That helps debugging.

Flask doesn't seem to recognize file changes

A little background:
I've been working on this project for about six months now and it's been running on Flask the whole time. Everything has been fine, multiple versions of the backend have been deployed live to support an app that's been in production for months now.
The development cycle involves writing everything locally and using Flask-Script's runserver command to test everything locally on localhost:8080 before deploying to a dev server and then finally to the live server.
The Problem: The other day my local flask instance, which runs on localhost:8080 apparently stopped respecting my local files.
I tried adding a new view (with a new template) and I got a 404 error when trying to view it in my browser.
I then tried making some test changes to one of the existing pages by adding a few extra words to the title. I restarted flask and none of those changes appeared.
I then went as far as deleting the entire views.py file. After restarting flask again, much to my dismay, I could still view the pages that were there originally (i.e. before this behavior started).
Finally, I made some changes to the manage.py file, which is where I put all of the Flask-Script commands, and they weren't recognized either. It's as if flask started reading from a cached version of the filesystem that won't update (which very well might be the case but I have no idea why it started doing this or how to fix the issue).
FYI: Browser caching shouldn't be an issue b/c I have the dev tools open with caching disabled. Plus the fact that changes to manage.py aren't being noticed shouldn't have anything to do with the browser.
You've most likely used flask in the DEBUG mode in which it auto reloads templates the app whenever a file changes.
Try using
export FLASK_DEBUG=True
before running
flask run
For more information see http://flask.pocoo.org/docs/1.0/config/#DEBUG
I was having a similar issue and deleting the .pyc files solved it for me.

Flask website hosted over SSL not working in any microsoft browser (Edge or IE) but works in any other browser

I have three different python flask apps hosted on Apache using WSGI Flup webserver over FastCGI.
I am able to access all of the apps without any issues using any non-microsoft browser. Out of the three apps, two are just for services and return only json data while the third app houses our website. All the three apps are SSL enabled and can be accessed only through SSL.
The problem I am facing is that any version of Microsoft edge or IE is unable to open the flask app which serves the website, at all.
The error that I am getting in IE says that it is a DNS error. When I checked my Apache access logs, I found out that the hit by IE or edge is not even logged there. The logs appear though when I hit my other two JSON data returning flask apps through microsoft browsers.
The two apps which return only JSON data are working flawlessly in the Microsoft browsers as well as they are working in Chrome, Safari etc.
What can be the reason for the microsoft browsers to not be able to access only one flask app but render the other two over SSL considering that all is fine when the same is accessed through any other browser?
Any kind of help would be greatly appreciated. Thanks a lot.
P.S. - I have checked the settings of all the three flask apps, and all the three are configured in the same manner without any discrepancies.
Found that the problem was with favicon.ico file. Microsoft's browsers including Edge actively look for it on the server or web app root folder, and in case it doesn't exist, they simply refuse to display the page without giving out a proper error message.
The problem was solved by adding the favicon file through the method mentioned here: http://flask.pocoo.org/docs/0.10/patterns/favicon/

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

Google App Engine trying to access dev data

I'm running my app on my local machine and using the remote API to access a datastore on my production side. Everything was working great until I tried adding a second app in google app engine launcher (I believe this is what caused the issue) because I had to merge what I was working on with some more up to date code and wanted to test as I went along. Suddenly I can't even access the remote datastore anymore. I get the error
app s~buybottandrew cannot access app dev~buybottandrew's data
I tried clearing the local datastore which allows me to access the remote datastore once, then the problem comes up again.
I read suggestions on the default_partition flag and I've tried passing that as well, with a muitiplicity of different things including nothing and an empty string.
--default_partition=s~buybottandrew
It gives me the same error no matter the argument
dev_appserver.py: error: unrecognized arguments: --default_partition=s~buybottandrew
If I remove all my remote api code and deploy it when I test it on the production server everything works perfectly. I can't seem to narrow down what is going on for the life of me.
Any input would be greatly appreciated.
--default_partition was removed in the new SDK. If you want to use the legacy SDK function, you can use old_dev_appserver.py --default_partition

Categories

Resources