I'm setting up a new flask web app hosted on a python app on cPanel, everything working but each time I send a command or i refresh the page or a new function runs the 404 error appears. If i refresh the page 3 times starts working again.
I tried to change the settings of Flask, but nothing is working.
something on your script of sessions is missing. You can either redeploy and see if it is solved. Or check the log file if the system is giving any warning or errors. In case you are not sure how to check log file then follow the steps in this tutorial.
tutorial
Related
After deploying django app on heroku the url after every form submission or link in site been press resulting with "?next=" inserts into the URL address, I don't understand from where it comes and why heroku keep inserting them in a random way, running the application locally just working perfectly.
I've deleted the application from heroku and upload it again, the fault persists.
There's no http errors what so ever. If I keep submitting the form eventually will works.
For example: pressing the log button in the django admin console results with this URL: https://appname.herokuapp.com/admin/login/?next=/admin/login/admin/, hitting it quite a bit will finally make it work with the correct url display: https://mishnayot.herokuapp.com/admin/.
Switching from heroku postgres to AWS RDS postgres didn't help.
Help will be very appreciated.
When a user hits a page requiring authentication, they get redirected to the login URL with a ?next= indicating the page they were trying to access. This way, after they've logged in, they'll get the page they intended to access.
In your case, it seems like /admin/login/admin/ requires a login and the login is actually at /admin/login/. I'm guessing you have a bad link to /admin/login/admin/ somewhere when you intended to just have /admin/login/?
Well, struggling for days just to understand it's heroku backend issue and there's not enough information that could help me solving it (i did try to contact heroku support directly but I'm on a free account).
Finally I decided to deploy it using elastic beanstalk. The implementation took some time with long learning curve but now my site works and works great!
Thanks for trying to help Tim.
Cheers!
I have a small problem with Django settings.
In my page I have some really big input and I got the error:
The number of GET/POST parameters exceeded settings.DATA_UPLOAD_MAX_NUMBER_FIELDS.
took me about 3sec google to find a solution
DATA_UPLOAD_MAX_NUMBER_FIELDS = None # None so it ignores the error -> change to big number results in the same error
In my local develop it works like a charm. On the server I did the same and after that:
service apache2 restart
but i still get the error.
Any ideas?
I found a soultion.
For some reason I don't know apache2 didn't load the whole settings.py.
I just reuploaded the entire App and restartet apache2 after that.
Maybe there was a bad path or something.
My site is working fine. I can access all the pages. But when I am accessing admin page, it loads, prompts for username and password. After entering username and password when clicked login, it takes sometimes and after that I get below error:
This page isn’t working mytestapp.company.com didn’t send any data.
ERR_EMPTY_RESPONSE
After refreshing the page, I get below error:
Service Unavailable HTTP Error 503. The service is unavailable.
After this no page loads. After restarting IIS using cmd (iisreset /noforce) again when I try to refresh the homepage, I see I am logged in which means admin page logged me in but after that response did not come and it something went wrong on the server side which caused server to crash.
I am not sure how to proceed with this. Earlier my admin site use to work fine. No recent changes in code. The only change I did is I synced the DB from another DB which has more data.
I am using virtual env which has
python version is 2.7.3, Django version 1.3 in it
IIS version 7.5 on WindowsServer 2008R2 (Python IsAPIe handler)
Please help me on this. I am stuck with this issue...
Issue is resolved now. IIS service was getting stopped because of a series of error caused while rendering admin page. After checking windows event log and understanding error code, got to know that the Python-Runtime.dll which admin page was referring was having some issue. I replaced the dll with the previous working version and then everything started working fine.
I'm using Django 1.6.1 and Geraldo Reports 0.4.17, Firexos 24.3.0. Both in DEV & production environments I get the error "This PDF document might not be displayed correctly. In production,using Nginx 1.0.15 and gunicorn 18.0. Only browser used is Firefox.
If I run 2-3 reports or run one, then go any page and then run another report or even same as before, error comes up. If I restart Nginx & gunicorn, any report shows up perfect, until error again.
Checked for errors on nginx access & error logs, guninconr & django logs and there is no error reported to this issue.
When calling the reports I was originally using the standard 'generate_by method' and then when seeing this report in DEV env, changed it to 'generate_under_process_by' method. Unfortunately, that does not help.
How can I troubleshoot / solve this issue? Is there something I am missing?
Thanks.
I realized I was using the same HTTP response variable for all reports. I must define its value inside each report, even if it's repetitive.
I'm brand new to Django and am working through the tutorial. I fat-fingered a bit of code which would normally raise a syntax error or name error if I were running the file like a standard script. However, when I try to browse to the view in my web-browser using manage.py runserver I just get a blank page with no relevant error/traceback. The same is true of the console from which I ran manage.py runserver -- it just shows the GET request. Also, when starting the server, the console displayed "0 errors found" which was clearly false.
My question is how does Django report errors and tracebacks? Do I need to enable anything? (I have DEBUG = True in my settings.py file) It's kind of un-nerving to me that I could make a little typo and all of a sudden the entire website stops working and I'm not given a report of where the problem is.
Regarding running the development server, it'll say that there are 0 errors found in getting the server started. This typically refers to configuration and syntax in your settings.py file and models. It will only report errors that come up through the startup code path, which typically it doesn't go through your view handlers.
As you modify files, the development server is smart enough to reload itself. Syntax errors will crash the development server.
If you are seeing a blank page and the GET request returning successfully, then your code is working fine from a Django perspective. It's handling the request and returning a response, though you know the response is incorrect. Typically, syntax errors here will cause the view to return a 500, where you'll see debug information returned in the view (if DEBUG = True) and you'll see it in the console as well. It would seem that your typo was valid python as it went through your view handler successfully to return a blank page. There really isn't anything you can do here other than unit tests as to Django, a blank page could be a valid response.
Now as you move from development to production, you'll likely want to know when a page runs into an error. Django builds off Python's logging framework to handle error and other messages. The defaults in your settings.py file, set up a mail_admins handler that handlers error on django.request. If you set up ADMINS and EMAIL_BACKEND in your settings file, you'll get e-mailed the stack trace for any 500 error that happens on your server. As you get more sophistication, you can create your own logging by sending messages to Python's logging framework and custom handlers.
import logging
logger = logging.GetLogger(__name__) #using the module name so in your settings.py you can configure different settings per module
logger.info('msg')
logger.error('msg')
I'd recommend looking into Sentry as a handler for your error messages, that does hit counting and stores your error logs.