Why would a deployed site shows up with distorted layout

73 views
Skip to first unread message

Ram

unread,
Feb 29, 2024, 1:25:30 AMFeb 29
to django...@googlegroups.com
Hi,

We are able to deploy our pre-production site successfully using jenkins deployment and as part of the deployment we do the following:

1. Django application with runserver
2. Gunicorn restart
3. Nginx restart
 
But our web application loads with distorted layout and we have this setting for staticfiles

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

We are wondering what is missing?

Best Regards,
~Ram

Muhammad Juwaini Abdul Rahman

unread,
Feb 29, 2024, 3:11:20 AMFeb 29
to django...@googlegroups.com
Most probably your nginx doesn't serve endpoint 'static'.

--
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 django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BOi5F2xrz-hiJphYeuGX56hU26wWJGduUZHNibTUXVs-KtjeA%40mail.gmail.com.

Shiva Shankar Pallapu

unread,
Feb 29, 2024, 9:16:03 AMFeb 29
to django...@googlegroups.com
STATIC_URL = '/static/' if not DEBUG: STATIC_ROOT = '/home/django/www-data/example.com/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static/'), ]
Try this I Collected it from Django Documentation.

--

Amitesh Tripathi

unread,
Feb 29, 2024, 9:16:04 AMFeb 29
to django...@googlegroups.com
Your website is in debug mode??

--

ASAMOAH EMMANUEL

unread,
Feb 29, 2024, 1:38:24 PMFeb 29
to django...@googlegroups.com
Replace your username with this and run this code: sudo usermod -aG username www-data
sudo chown -R :www-data /home/username/projects/personal



--
I don't stop when I'm tired, I only stop when the job is done.

ASAMOAH EMMANUEL

unread,
Feb 29, 2024, 1:39:11 PMFeb 29
to django...@googlegroups.com
I faced this issue before and I know how frustrating it can be. after sifting through several results, this worked. sudo usermod -aG username www-data

sudo chown -R :www-data /home/username/projects/personal

Mordecai Etukudo

unread,
Feb 29, 2024, 4:32:19 PMFeb 29
to django...@googlegroups.com
First install white noise and collect static you are good to go 

ram.mu...@gmail.com

unread,
Mar 4, 2024, 7:22:16 PMMar 4
to Django users
Thank you all for providing valuable answers. 

1. My case was actually related to the permission issue on ~/www-data/example.com/static folder as mentioned by @Asamoah Emmanuel. 
2. Though I changed the ownership of the folder with 
siteUser:www-data ~/www-data/example.com/static
the problem was not resolved, but resolved with the next step.
3. So I had to add siteUser in nginx.conf file and then restarted gunicorn and nginx


Best Regards,
~Ram
Reply all
Reply to author
Forward
0 new messages