I have some models with ImageFields (that work fine on my home computer test environment). When I put the project on a server using Passenger WSGI, submitting a form in the admin containing an ImageField doesn't work.
If DEBUG is True, I get a 404 error page saying that it can't find 500.shtml (I didn't create a 500 error page). No error appears in the server console.
If DEBUG is False, I get an Apache message saying it can't find "admin/red_projects/project/add/" (the URL it was JUST at), and the server error log has a message saying that the folder admin doesn't exist in the filesystem (since it's not a directory, just a Django urlconf), or it just hangs and doesn't load the page.
I already recursively set the permissions on the media directory to 755, and that didn't do anything. Everything else works fine, including submitting admin forms without ImageFields.
Django dosn't serve media or static files when debug is False, you shoud have and alias in your configuration to serve them via the web server directly (Way faster than using django to serve them)
Read this, it will help you put it in production : Deploying static files
Edit: This is for static files, same things aply to media files
Related
here is a picture of static directory
This website runs properly locally but then when I deployed it to heroku, it would load halfway and then go blank, the chrome console pops up errors I haven't still been able to find solutions to (It was built using next.js, django and postgresql). I'm new to all of this, please I need help?
favourndubuisi.herokuapp.com
It looks like you need to configure static directories in your Django setup as Django is trying to process the _next directories.
See the error reported on one of the missing chunks.
http://favourndubuisi.herokuapp.com/_next/static/chunks/821.ff7693b6a698a8d3.js
Page not found (404)
Request Method: GET
Request URL: http://favourndubuisi.herokuapp.com/_next/static/chunks/821.ff7693b6a698a8d3.js
Using the URLconf defined in config.urls, Django tried these URL patterns, in this order:
admin/
about/
projects/
technologies/
contact/
^static/(?P<path>.*)$
^media/(?P<path>.*)$
The current path, _next/static/chunks/821.ff7693b6a698a8d3.js, didn’t match any of these.
You’re seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
However, this chunk works
http://favourndubuisi.herokuapp.com/static/_next/static/chunks/pages/index-77a9eb1106a2340d.js
which means you have a static directory, I would place all items under static from _next under your Django static directory including the chunks folder.
I managed to solve it by deleting and recreating the static files
[Update]
I've managed to upload a small file (but not yet a large image). ../media/filer_public/ sub-directories are being correctly created and file correctly uploaded. Need to investigate nginx configurations.
[OP]
I've logged into a new Django CMS system as superuser but cannot Add filer image or Add filer file to a page as the file upload silently fails; very briefly flashing its upload graphics but not actually uploading anything. I believe all the settings.py are correct as static artifacts are rendered correctly and Nginx has credible similar locations for both media and static directories.
I believe all file and directory permissions and ownerships are correct; i.e. that Nginx has user and / or group ownership of the Django CMS app directories and that permissions are correct.
The Postgres table filer_folder has a row for a new filer folder I created when editing a page but no corresponding directory has been created in the file system. I can add text and new text block plugins that get saved correctly.
Django CMS is running in a Docker container web which I have confirmed has rw (read/write) access to a Docker volume.
I see nothing abnormal in webs logs.
How can I find out what's (not) happening?
Simply adding client_max_body_size 10M; to the nginx configuration for the site solved the issue.
Similar issues were addressed in Stackoverflow and elsewhere:
Server Fault
Setting up Django and your web server with uWSGI and nginx
I am working within the File Manager of Hostgator and have already set up a Django project which displays "It worked! Congratulations on your first Django-powered page." Following this, I ftp'ed my local Django project (which works fine on the local server) into File Manager and stored it into a temp folder, copying over the changes to the urls.py, views.py, and settings.py files of the new Django project along the settings path.
However, nothing appears to be changing on the website - it's still on the "Congratulations" page. I've tried moving various templates into different places to see if it responds, but that doesn't appear to be doing the trick. Thoughts?
You need to read documentation about how to manage your project on the hostgator servers
I am trying to use HTSQL for one of my Django projects. For that I followed the procedure given HERE for furnishing HTSQL/Django requirements. Then I cloned the HTSQL repository for trying the example/demo in it from HERE. I am testing this on Django v1.4. The default db used in the demo example is sqlite3. In Django python shell, the queries are working fine now as per THIS question. But as demonstrated on HTSQL Website, it has a very powerful frontend to communicate with the database and also generates efficient queries (reference). I am trying to use this particular feature for my Django application which is also demonstrated in the demo/example django app from HTSQL. In the demo app, when I started my local django server and tried to access the following url:
localhost:8000/htsql/
The page loads and when I write the following lines:
/polls_poll
to see the data from the polls_poll table, the RUN button does nothing and so does the more drop down menu. No error, no response, no data fetched from the polls_poll table. Then I noticed that the page wasn't loading properly i.e this trace was generated on the Django server terminal. So basically,
codemirror .js and .css files were throwing HTTP 500 error. For that I searched for the links of the codemirror .css and .js files and provided those links in the index.html of the HTSQL resided in the static folder. Following is its path:
>>> /usr/local/lib/python2.7/dist-packages/htsql/tweak/shell/static
Now the terminal trace has changed to THIS
But still the RUN button does nothing and no data is fetched from the table polls_poll
Am I doing something wrong or missing something??
CodeMirror just changed the download URL for their packages, which broke HTSQL shell. You either need to apply the following patch manually:
https://bitbucket.org/prometheus/htsql/changeset/f551f8996610bb68f2f8530fc6c0dbf6b5c34d90
or you can wait for the next bugfix release of HTSQL, which will be out in a day or two.
I'm running a Django app for my root public_html folder, and it's working fine. But there's a problem with one of my other apps. The problematic app is accessed through a redirect to a subdirectory (e.g. http://workingsite.com redirects to public_html, http://brokensite.com redirects to public_html/foo)
The problem is that the session expires whenever anything needs to be saved in the Django admin (either added or changed). If you try again, sometimes it works. This does not happen on my own machine when I run the Django dev server.
The timezone in both of the app settings.py files is the same, which is the same as the timezone in both of the .htaccess files.
The apps are almost identical, except the working app uses WYMEditor and the broken one uses TinyMCE as its text editor. Don't know why that would do anything to cause the problem, but I included it just in case. Also, I've made a custom CSS file for the admin backend in the broken app (again, shouldn't cause a problem).
Seems to have been a configuration issue with the company I was hosting with - it's not happening anymore.