Why is appearance of admin page so different between development and deployment servers?

94 views
Skip to first unread message

talex

unread,
Mar 21, 2015, 11:27:13 PM3/21/15
to django...@googlegroups.com
While using the Django development server, I like the appearance of the admin site from django.contrib.  After deploying the application on a remote Apache server however, the appearance of admin is very different and I do not like it.  The css files in

/usr/local/lib/python3.3/site-packages/django/contrib/admin/static/admin/css

are identical. 

How can I make the deployed version of admin look like the development server version?

Thanks.


Vijay Khemlani

unread,
Mar 22, 2015, 12:51:18 AM3/22/15
to django...@googlegroups.com
They should look exactly the same

are all the static files (CSS / JS) being loaded correctly in production?

--
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 post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6c3ce0ee-1aab-4148-93ab-ef613c69117e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ishaan Bahal

unread,
Mar 22, 2015, 2:13:02 PM3/22/15
to django...@googlegroups.com
Take a look at your production server log, you may find that your static files aren't actually being served by your production server. This also happens when you set debug=False in settings.py. Visit https://docs.djangoproject.com/en/1.7/howto/static-files/deployment/  to setup static files properly.

Anderson Resende

unread,
Mar 22, 2015, 2:33:22 PM3/22/15
to django...@googlegroups.com
Em production you need to run the command: python manage.py collectstatic and you need configure your production serve like "apache" to read the 'static' folder in you root project.

talex

unread,
Mar 22, 2015, 10:33:21 PM3/22/15
to django...@googlegroups.com
All,

Thank you.  I had negeleted to enable file serving on Apache for
../python3.3/site-packages/django/contrib/admin/static/admin

I added the stanza:

Alias /static/admin  ../python3.3/site-packages/django/contrib/admin/static/admin
 <Directory          ../python3.3/site-packages/django/contrib/admin/static/admin>
      Require all granted
 </Directory>

to Apaches's httpd.conf, and now the correct css files are found.

Thanks again.

talex

unread,
Mar 22, 2015, 10:54:11 PM3/22/15
to django...@googlegroups.com
On second thought maybe using
/python3.3/site-packages/django/contrib/admin/static/admin
directly is not the best practice. 

I tried using  collectstatic, but then the admin could not find it.
Please comment.

Mike Dewhirst

unread,
Mar 22, 2015, 11:27:40 PM3/22/15
to django...@googlegroups.com
On 23/03/2015 9:54 AM, talex wrote:
> On second thought maybe using
> /python3.3/site-packages/django/contrib/admin/static/admin
> directly is not the best practice.
>
> I tried using collectstatic, but then the admin could not find it.
> Please comment.

Here is a collectstatic incantation which works for me ...

/usr/bin/python /var/www/ssds/manage.py collectstatic
--settings=ssds.settings.staging --noinput

It properly copies admin static files like this excerpt from my buildbot
stdio ...

<snip>

Copying
'/usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/img/icon_searchbox.png'

<snip>

Copying
'/usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/css/base.css'
Copying
'/usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/css/dashboard.css'

<snip>

Copying
'/usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/js/SelectBox.js'
Copying
'/usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/js/prepopulate.min.js'

<snip>

Copying
'/usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js'
Copying
'/usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js'


>
> On Sunday, March 22, 2015 at 3:33:21 PM UTC-7, talex wrote:
>
> All,
>
> Thank you. I had negeleted to enable file serving on Apache for
> ../python3.3/site-packages/django/contrib/admin/static/admin
>
> I added the stanza:
>
> Alias /static/admin
> ../python3.3/site-packages/django/contrib/admin/static/admin
> <Directory
> ../python3.3/site-packages/django/contrib/admin/static/admin>
> Require all granted
> </Directory>
>
> to Apaches's httpd.conf, and now the correct css files are found.
>
> Thanks again.
>
>
>
>
>
> On Saturday, March 21, 2015 at 4:27:13 PM UTC-7, talex wrote:
>
> While using the Django development server, I like the appearance
> of the admin site from django.contrib. After deploying the
> application on a remote Apache server however, the appearance of
> admin is very different and I do not like it. The css files in
>
> /usr/local/lib/python3.3/site-packages/django/contrib/admin/static/admin/css
>
> are identical.
>
> How can I make the deployed version of admin look like the
> development server version?
>
> Thanks.
>
>
> --
> 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
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/09edef10-539e-4a22-99f7-2b3d0d733f71%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/09edef10-539e-4a22-99f7-2b3d0d733f71%40googlegroups.com?utm_medium=email&utm_source=footer>.

talex

unread,
Mar 22, 2015, 11:29:29 PM3/22/15
to django...@googlegroups.com
I apologize for the confusion, but I have ended up following Andreson's advise and used "python manage.py collectstatic"
to generate a directory that I uploaded to my Apache server.  That captured all the files needed for admin, and after I got my httpd.conf file right, it worked correctly.

I no longer use ../python3.3/site-packages/django/contrib/admin/static/admin directly.
Reply all
Reply to author
Forward
0 new messages