开发者

Django share CSS and Javascript for admin and public

开发者 https://www.devze.com 2023-03-04 21:01 出处:网络
I am using django grapelli. It is in the static/admin/ directory开发者_运维问答, which is used by admin site.

I am using django grapelli. It is in the static/admin/ directory开发者_运维问答, which is used by admin site.

I create a public directory, which separate from admin, and can be access from public.

Django grapelli come with jquery and some other css.

Should I create a static/public/ to store css and js for public site or should I use the admin static css and js?

I create a a directory name public in static directory - static/public/, but I seems not able to serve the static files.


In order to make it as seamless as possible, django serves the admin media in the development server from within the django sources.

In order to make it take the grapelli media, you should do:

python manage.py runserver --adminmedia=./static/public

And it serves the admin media from that directory!

0

精彩评论

暂无评论...
验证码 换一张
取 消