Hi, Sorry to hear this. Perhaps we can have a private email conversation where we debug this together. I need to look at your NGinX configurations, static directory, configuration of static assets in settings file etc. Let me know if you prefer this option. Swimmingly, Simple_genius
On Sat, Aug 31, 2024 at 6:16 PM Abulbanat Mosta (Abulila) < [email protected]> wrote: > Hi Emmanuel > i tried the solution you provided , but sadly it doesn't work too- i add > the my user and www.data user to the same group (i tried this with sudo in > venv and outside venv) igave the permissions required to deal with the > files - but no way. its still not working- . i am sure that's a permissions > issue but what a kinf of issue is ? any other suggestion > > Le dimanche 25 août 2024 à 18:27:56 UTC+1, Abulbanat Mosta (Abulila) a > écrit : > >> Thank you a lot EMMANUEL for this hint- i'll try and return back to >> you with insghts >> >> Le dimanche 25 août 2024 à 15:39:54 UTC+1, ASAMOAH EMMANUEL a écrit : >> >>> I understand how frustrating this can be. I also faced this same issue >>> for months and this was how I solved it. >>> >>> sudo usermod -a -G your_user www-data >>> >>> sudo chown -R :www-data /path/to/your/static/folder >>> >>> >>> Let me know if it is still not solved and I will help you. >>> Swimmingly, >>> Simple_genius >>> >>> On Sun, Aug 25, 2024 at 2:16 PM Abulbanat Mosta (Abulila) < >>> [email protected]> wrote: >>> >>>> Im getting crazy and very frustrated about deploying static files of >>>> my django app since 1 month- all things are ok except static and media >>>> files which cannot be served by the web server ( i tried apache and nginx) >>>> Firstable- in dev mode my app is ok and the static file are correctly >>>> loaded. >>>> switching to prod Env - all my attempts to get over the issue are >>>> unsuccessful. >>>> im using >>>> - ubuntu Ubuntu 22.04.4 LTS >>>> - Django==3.2.9 >>>> - gunicorn (version 22.0.0) as app server >>>> - nginx 1.18.0 as reverse proxy - >>>> >>>> i set up the setting.py and nginx conf with the correct path to static >>>> folder as following >>>> >>>> >>>> STATICFILES_FINDERS = [ >>>> 'django.contrib.staticfiles.finders.FileSystemFinder', >>>> 'django.contrib.staticfiles.finders.AppDirectoriesFinder', >>>> ] >>>> >>>> STATICFILES_DIRS = [] >>>> >>>> STATIC_URL = '/static/' >>>> STATIC_ROOT = '/var/www/html/bweb/staticfiles' >>>> >>>> MEDIA_URL = '/media/' >>>> MEDIA_ROOT = '/var/www/html/bweb/media' >>>> >>>> >>>> LOCALE_PATHS = ( >>>> os.path.join(BASE_DIR, 'locale'), >>>> os.path.join(BASE_DIR, 'core', 'locale'), >>>> >>>> ---------------------- >>>> >>>> -------------------------- >>>> nginx >>>> >>>> location /static/ { >>>> alias /var/www/html/bweb/staticfiles/; >>>> access_log /var/log/nginx/static_access.log; >>>> error_log /var/log/nginx/static_error.log; >>>> expires 30d; >>>> } >>>> >>>> location /media/ { >>>> alias /var/www/html/bweb/media/; >>>> access_log off; >>>> expires 30d; >>>> } >>>> >>>> ------------------------ >>>> >>>> >>>> >>>> - i installed & set gunicorn to serv the app >>>> >>>> - i run the collectstatic command witch copied the files into the path >>>> i mentioned in settings.py (several times - django detects each time the >>>> presence of the files what means that the conf is ok) >>>> -im using debug = false in prod mod >>>> >>>> =>> whats happening >>>> my app is running in prod mode (gunicorn seems to do the job) but i'm >>>> getting 404 errors for all my static files - >>>> ==> Here what i tried >>>> - i gave permissions to data-www user over the folder and all its >>>> components which are actually present inside with the folder with the >>>> correct permissions >>>> - i run the server in a separate port which is unused in the system - >>>> with allowed permissions in firewall >>>> -i cleared the cache and tried out several browsers >>>> - i tried to put manually a test file in the folder and try to access >>>> with curl - >>>> the files still dont want to be served even the test file. >>>> Log files aren't showing any significant error . >>>> >>>> all those attempts were tested with apache web server but i encounter >>>> the same issue >>>> >>>> ------- >>>> >>>> Any one have faced such issue? ubuntu problem ? Django version issue? >>>> >>>> I'll be very thankful for help >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Django users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/django-users/450049e4-2fff-4700-a4da-286826bf1d95n%40googlegroups.com >>>> <https://groups.google.com/d/msgid/django-users/450049e4-2fff-4700-a4da-286826bf1d95n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> >>> >>> -- >>> I don't stop when I'm tired, I only stop when the job is done. >>> >> -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/dc5aeac5-8b2d-42e1-95d9-a41b6627cd42n%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/dc5aeac5-8b2d-42e1-95d9-a41b6627cd42n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- I don't stop when I'm tired, I only stop when the job is done. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABFHQYxig-4td%2Br%2BW%3D9CifX3zurqJUXZ3i5V9rh%2BORsX%3DrEXJA%40mail.gmail.com.

