Link to issue at my github: https://github.com/derrellj/shop2.git

  1. Static Files:
  • My static files are not being served correctly Despite configuring the STATIC_URL and STATICFILES_DIRS. I have checked the browser console for any errors, but the files are not being found.
  1. Media Files:
  • I am having issues with media file uploads. When users try to upload images, the files are not stored in the specified MEDIA_ROOT. I suspect there might be an issue with my media configurations.

I have taken the following steps to address the issues:

  • Checked and rechecked my static and media configurations in the Django settings file.
  • Ensured that the STATIC_ROOT was correctly specified for production deployment.
  • Confirmed that the directories specified in STATICFILES_DIRS and MEDIA_ROOT exist and are writable.

How are you running your project?

What wsgi container are you using? (uwsgi? gunicorn? something else?)

What web server are you using? (Apache? Nginx? Something else?)
What is your web server’s configuration for your project?

Hi Ken,

I primarily run my project within a Docker container. Since
encountering the error, I’ve been using a virtual environment with the
command: source .ready/bin/activate.

For production, I plan to use Gunicorn as my WSGI server.

Regarding the web server, I believe I’m using Apache. However, when I
tried to get the name of the web server using the following code in my
web_project wsgi.py file:

import os

web_server = os.environ.get("SERVER_SOFTWARE", "Unknown")
print(f'Name of web service: {web_server}')

I get Unknown.

thanks for getting back to me.

Your Django code is completely separate and independent of the web server being used. Django doesn’t know or care what the web server is going to be.

For us to have any chance of helping you diagnose this, you’re going to need to provide a complete description of what and how you’re trying to run this, including all configuration or operational scripts and commands being used. We need all the details about how you’re trying to run this, and the environment in which it’s being run.

Hi Kevin,

To provide more details about my setup and better facilitate diagnosis, here’s some additional information:

  1. Running Environment:

    • I primarily run the project within a Docker container.
    • For local development, I use a virtual environment activated with the command: source .ready/bin/activate
  2. WSGI Server:

    • For production, I intend to use Gunicorn as the WSGI server.
  3. Web Server:

    • I believe I’m using Apache as the web server.

I’m facing an issue with my app not displaying pictures and text from the database. The project is set up in a Docker container, and for local development, I use a virtual environment activated with source .ready/bin/activate. Gunicorn is intended as the WSGI server, and I believe Apache is the web server.

Here’s the GitHub repo for reference: https://github.com/derrellj/shop2.git

Could you help me troubleshoot this? Any specific logs or error messages would be useful.

How? How specifically are you running your project?

What are you using now, that you’re requesting assistance with?

I’m getting a 404 trying to reference that page.

Please provide the details along with the actual scripts and commands being used. Summary statements and conjectures (“I believe I’m using Apache”) are not sufficient.

Also provide the actual settings file entries for the static and media file related settings.

(See Websocket connection failed in production. (Nginx, Gunicorn, Daphne) (Django/React) as an example of the types and quantity of information that is useful for issues like this.)

Hi Ken,

Sorry about the GitHub link. It should be good to go now. Let me know if the GitHub link does not answer your question.