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.
Related
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
I apologize for any mistakes made or dumb questions asked, but this is my first one here.
I tried to search for the solution, but wasn't able to. Here is what's going on.
I have Nginx + virtualenv + Gunicorn + Django project. Django is still in Debug mode.
The thing I can not figure out is why all my Django responses are hardly cached. E.g., if I request a certain Url/View with no URI parameters, it will show me exactly what is coded, but if I then pass predefined parameters, that should be giving me another result, however it still shows the previous one.
As far as I can see, each of such responses is being cached per each Gunicorn worker. So when I restart Gunicorn, I then can see the proper result, however that is also cached right away.
I also tried running Gunicorn with --debug option, but it looks like that is not the solution.
Does anybody know where should I dig to? Thanks in advance for any help.
UPDATE:
If I put...
HttpResponse('abc')
at the very beginning of the view, server will sure give me that as response. If I then change it to...
HttpResponse('def')
the server will still give me 'abc' as a response until I restart Gunicorn in the virtualenv. When I restart Genicorn and check it gives me 'def', it will then be giving me 'def' all the time until I restart Gunicorn again.
It is my first time trying to get a Django application live on the net but I am having an issue with the URls.
The working local URL of my application is
http://localhost:8000/surveythree/ - This works as expected.
However when I upload my project to my hosting account I cant seem to locate the relevant page using the shortened URL as provided by the URLconf, in this case it should be /surveythree/
url(r'^surveythree/$', SurveyWizard.as_view([SurveyForm1, SurveyForm2, SurveyForm3, SurveyForm4, SurveyForm5])),
I can locate the page if I use the full filepath however.
http://www.mywebsite.com/bias_experiment/src/survey/templates/formtools/wizard/wizard_form.html
I thought the benefit of the URLconf was to shorten the URL to something like one of the following
http://www.mywebsite.com/bias_experiment/surveythree/
http://www.mywebsite.com/bias_experiment/src/surveythree/
http://www.mywebsite.com/bias_experiment/src/survey/surveythree/
Is there something simple that I am missing here? If anyone could tell me what the shortened URL should be based on the above it would be great. I have been trying multiple combinations for a while now but I don't know if I am going around in circles or doing it wrong.
Thanks in advance.
It doesn't look like you have actually deployed your site with a proper server. You can't just upload the files to any webserver and expect then to run: you need to configure a wsgi server and connect it to your app.
The documentation is here but to be honest I'd be amazed if your college server supported it at all, if all you have is a shared folder. You may be able to get it to work with FastCGI, but I wouldn't hold out a whole lot of hope.
(And even though you say that going to that long URL "works", I'd guarantee that all you're seeing is the raw HTML template. There's no way that any actual dynamic functionality will be working like that, as you'd see if you actually tried to submit the form at that URL.)
Deploying Django apps is much more complicated. To run in more "production" environment you will need to configure:
virtualenv to keep pip modules which your app required separate from global environment.
nginx for hosting static files ( you can copy them to some folder with ./manage.py collectstatic.
WSGI server: uWSGI or Gunicorn are both nice choices.
supervisor: for running and restarting WSGI and any other apps (for example celery) running in background
It's a lot for a start, so it's good to follow some tutorial and use ready to use config snippets.
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.
In my Django application, I list the contents of a directory which contains movies (of around 400 MB). When I try to play the movie in the browser, I get MemoryError. I have this movie content inside the "media" folder which I have marked to serve as statically.
I believe this movie should have been served directly through my web server without passing the request to Django. Is there some error in my configuration or is there whole together a different solution available for serving movies as in my case.
I am using lighttpd with Django and FCGI.
Thanks.
You are running out of memory because you read the whole file in memory & buffer it before serving it. Remove the static url config from django urls.py and configure that url to be served by lighthttpd.
But the best way for movies of that size are best served is streaming. Take a look at any media streaming server and see if it helps you. This may help you.
Streaming movies by flowplayer and lighthttpd
--Sai
Could it be that you haven't configured lighttpd to handle requests to /media/ itself and Django is running in debug mode (DEBUG = True in your settings.py).
If you follow Django's own docs for lighttpd deployment, this shouldn't happen.
I solved the error myself.
Actually the problem was with a misconfiguration with my lighttpd server. The problem was that I had configured my webserver to redirect every request to Django and allow Django to process the request and server the response through the webserver.
So, what was happening is when I request to play a large movie file (say around 400 MB), this request went to Django and somehow Django was loading the file in the memory.
Since it was an embedded device with a limited memory, Django threw an "MemoryError".
I changed the configuration of my webserver and everything worked like a charm.
Hope this helps someone in the future. Cheers!