Python论坛  - 讨论区

标题:[python-chinese] django中的css和js文件如何处理

2007年11月08日 星期四 14:00

朽木klutz chumpklutz在gmail.com
星期四 十一月 8 14:00:14 HKT 2007

ÎÒÕÒÈË×öÁËÒ³Ãæ¿ò¼Ü£¬ÀïÃæÓõ½ÁËcssºÍjsÎļþ£¬¿ÉÊÇÎҷŵ½djangoÖÐ×÷Ϊ¸¸Ä£°åʹÓÃʱҳÃæ²»ÄÜÕý³£ÏÔʾ£¬Í¼Æ¬Ò²²»ÏÔʾ

ͼƬÊÇ·ÅÔÚimageĿ¼µÄ£¬cssÊÇ·ÅÔÚcssĿ¼µÄ£¬ÎÒ°ÑÕâЩ·¾¶¸Ä³É¾ø¶Ô·¾¶¾Í¿ÉÒÔ£¬¿ÉÊÇÎÒ²»Äܶ¼Ð´³É¾ø¶Ô·¾¶°¡£¬ÎҼǵúÃÏñ
Óнâ¾ö°ì·¨£¬´ïÈËÃÇ°ïæ°¡
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071108/6136e8e5/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月08日 星期四 14:09

beck917 beck917在gmail.com
星期四 十一月 8 14:09:26 HKT 2007

# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com"
MEDIA_URL = 'http://localhost:8000/media_site/'

ÉèÖÃÕâ¸ö¾Í¿ÉÒÔÁË.¾ÍÊÇÒªÓþø¶Ô·¾¶µÄ,ÕâÑù×ÓÒÔºó°Ñ¾²Ì¬·þÎñÆ÷µ¥¶À³öÀ´¾ÍºÜ·½±ãµÄ

Äã˵¾ø¶Ô·¾¶¿ÉÒÔ,Ó¦¸ÃÊÇÒѾ­ÉèÖú÷þÎñÆ÷µÄ¾²Ì¬»·¾³µÄÁË°É??
ÔÚ07-11-8£¬Ðàľklutz <chumpklutz在gmail.com> дµÀ£º
>
> ÎÒÕÒÈË×öÁËÒ³Ãæ¿ò¼Ü£¬ÀïÃæÓõ½ÁËcssºÍjsÎļþ£¬¿ÉÊÇÎҷŵ½djangoÖÐ×÷Ϊ¸¸Ä£°åʹÓÃʱҳÃæ²»ÄÜÕý³£ÏÔʾ£¬Í¼Æ¬Ò²²»ÏÔʾ
>
> ͼƬÊÇ·ÅÔÚimageĿ¼µÄ£¬cssÊÇ·ÅÔÚcssĿ¼µÄ£¬ÎÒ°ÑÕâЩ·¾¶¸Ä³É¾ø¶Ô·¾¶¾Í¿ÉÒÔ£¬¿ÉÊÇÎÒ²»Äܶ¼Ð´³É¾ø¶Ô·¾¶°¡£¬ÎҼǵúÃÏñ
> Óнâ¾ö°ì·¨£¬´ïÈËÃÇ°ïæ°¡
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071108/f6c4ff48/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月08日 星期四 14:24

朽木klutz chumpklutz在gmail.com
星期四 十一月 8 14:24:31 HKT 2007

ÎÒËù˵µÄ¾ø¶Ô·¾¶¾ÍÊÇÎļþµÄ·¾¶

MEDIA_URL = 'http://localhost:8000/media_site/ '
ÏñÕâÖÖÉèÖõĻ°ÎÒÄܲ»ÄÜÉèÖóÉ"D:/test/static/"ÕâÀàµÄÎļþ·¾¶°¡

ÔÚ07-11-8£¬beck917 <beck917在gmail.com> дµÀ£º
>
> # URL that handles the media served from MEDIA_ROOT.
> # Example: "http://media.lawrence.com"
> MEDIA_URL = 'http://localhost:8000/media_site/ '
>
> ÉèÖÃÕâ¸ö¾Í¿ÉÒÔÁË.¾ÍÊÇÒªÓþø¶Ô·¾¶µÄ,ÕâÑù×ÓÒÔºó°Ñ¾²Ì¬·þÎñÆ÷µ¥¶À³öÀ´¾ÍºÜ·½±ãµÄ
>
> Äã˵¾ø¶Ô·¾¶¿ÉÒÔ,Ó¦¸ÃÊÇÒѾ­ÉèÖú÷þÎñÆ÷µÄ¾²Ì¬»·¾³µÄÁË°É??
> ÔÚ07-11-8£¬Ðàľklutz <chumpklutz在gmail.com > дµÀ£º
> >
> > ÎÒÕÒÈË×öÁËÒ³Ãæ¿ò¼Ü£¬ÀïÃæÓõ½ÁËcssºÍjsÎļþ£¬¿ÉÊÇÎҷŵ½djangoÖÐ×÷Ϊ¸¸Ä£°åʹÓÃʱҳÃæ²»ÄÜÕý³£ÏÔʾ£¬Í¼Æ¬Ò²²»ÏÔʾ
> >
> > ͼƬÊÇ·ÅÔÚimageĿ¼µÄ£¬cssÊÇ·ÅÔÚcssĿ¼µÄ£¬ÎÒ°ÑÕâЩ·¾¶¸Ä³É¾ø¶Ô·¾¶¾Í¿ÉÒÔ£¬¿ÉÊÇÎÒ²»Äܶ¼Ð´³É¾ø¶Ô·¾¶°¡£¬ÎҼǵúÃÏñ
> > Óнâ¾ö°ì·¨£¬´ïÈËÃÇ°ïæ°¡
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071108/2d3ddc9e/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月08日 星期四 14:32

beck917 beck917在gmail.com
星期四 十一月 8 14:32:46 HKT 2007

²»ÐÐ,ÄãÄÇÑùÉèÖõĻ°ÊDZ¾µØ·¾¶°¡.ÕâÑùµÄ»°¾ÍµÈÓÚ¾²Ì¬ÎļþûÓо­¹ý·þÎñÆ÷´¦Àí,±ðÈ˸ù±¾Ã»·¨¿´µ½ÄãµÄͼƬ.

Èç¹ûÄãÒªÊÇÓÃdjango×Ô´øµÄ·þÎñÆ÷µÄ»°:

ÔÚurls.pyÖмÓÉÏ:
urlpatterns += patterns('',
    (r'^media_site/(?P.*)$', 'django.views.static.serve',
{'document_root': 'media_site'}),
)
http://www.djangoproject.com/documentation/static_files/

Èç¹ûÊÇapacheµÄ»°:
¿´ÕâƪÎÄÕÂ
http://www.djangoproject.com/documentation/modpython/#serving-media-files

ÔÚ07-11-8£¬Ðàľklutz <chumpklutz在gmail.com> дµÀ£º
>
> ÎÒËù˵µÄ¾ø¶Ô·¾¶¾ÍÊÇÎļþµÄ·¾¶
>
> MEDIA_URL = 'http://localhost:8000/media_site/ '
> ÏñÕâÖÖÉèÖõĻ°ÎÒÄܲ»ÄÜÉèÖóÉ"D:/test/static/"ÕâÀàµÄÎļþ·¾¶°¡
>
> ÔÚ07-11-8£¬beck917 <beck917在gmail.com> дµÀ£º
> >
> > # URL that handles the media served from MEDIA_ROOT.
> > # Example: " http://media.lawrence.com"
> > MEDIA_URL = 'http://localhost:8000/media_site/ '
> >
> > ÉèÖÃÕâ¸ö¾Í¿ÉÒÔÁË.¾ÍÊÇÒªÓþø¶Ô·¾¶µÄ,ÕâÑù×ÓÒÔºó°Ñ¾²Ì¬·þÎñÆ÷µ¥¶À³öÀ´¾ÍºÜ·½±ãµÄ
> >
> > Äã˵¾ø¶Ô·¾¶¿ÉÒÔ,Ó¦¸ÃÊÇÒѾ­ÉèÖú÷þÎñÆ÷µÄ¾²Ì¬»·¾³µÄÁË°É??
> > ÔÚ07-11-8£¬Ðàľklutz <chumpklutz在gmail.com > дµÀ£º
> > >
> > > ÎÒÕÒÈË×öÁËÒ³Ãæ¿ò¼Ü£¬ÀïÃæÓõ½ÁËcssºÍjsÎļþ£¬¿ÉÊÇÎҷŵ½djangoÖÐ×÷Ϊ¸¸Ä£°åʹÓÃʱҳÃæ²»ÄÜÕý³£ÏÔʾ£¬Í¼Æ¬Ò²²»ÏÔʾ
> > >
> > > ͼƬÊÇ·ÅÔÚimageĿ¼µÄ£¬cssÊÇ·ÅÔÚcssĿ¼µÄ£¬ÎÒ°ÑÕâЩ·¾¶¸Ä³É¾ø¶Ô·¾¶¾Í¿ÉÒÔ£¬¿ÉÊÇÎÒ²»Äܶ¼Ð´³É¾ø¶Ô·¾¶°¡£¬ÎҼǵúÃÏñ
> > > Óнâ¾ö°ì·¨£¬´ïÈËÃÇ°ïæ°¡
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese在lists.python.cn
> > > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > > python-chinese-request在lists.python.cn
> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > >
> >
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> >
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071108/b0f634f8/attachment-0001.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月08日 星期四 16:18

朽木klutz chumpklutz在gmail.com
星期四 十一月 8 16:18:44 HKT 2007

ÎÒÔÝʱÊÇÔÚdjangoµÄ¿ª·¢»·¾³ÏÂ×öµÄÓõÄÊÇdjango×Ô´øµÄserver

ÔÚ07-11-8£¬beck917 <beck917在gmail.com> дµÀ£º
>
> ²»ÐÐ,ÄãÄÇÑùÉèÖõĻ°ÊDZ¾µØ·¾¶°¡.ÕâÑùµÄ»°¾ÍµÈÓÚ¾²Ì¬ÎļþûÓо­¹ý·þÎñÆ÷´¦Àí,±ðÈ˸ù±¾Ã»·¨¿´µ½ÄãµÄͼƬ.
>
> Èç¹ûÄãÒªÊÇÓÃdjango×Ô´øµÄ·þÎñÆ÷µÄ»°:
>
> ÔÚurls.pyÖмÓÉÏ:
> urlpatterns += patterns('',
>     (r'^media_site/(?P.*)$', 'django.views.static.serve ',
> {'document_root': 'media_site'}),
> )
> http://www.djangoproject.com/documentation/static_files/
>
> Èç¹ûÊÇapacheµÄ»°:
> ¿´ÕâƪÎÄÕÂ
> http://www.djangoproject.com/documentation/modpython/#serving-media-files
>
> ÔÚ07-11-8£¬ Ðàľklutz <chumpklutz在gmail.com> дµÀ£º
> >
> > ÎÒËù˵µÄ¾ø¶Ô·¾¶¾ÍÊÇÎļþµÄ·¾¶
> >
> > MEDIA_URL = 'http://localhost:8000/media_site/ '
> > ÏñÕâÖÖÉèÖõĻ°ÎÒÄܲ»ÄÜÉèÖóÉ"D:/test/static/"ÕâÀàµÄÎļþ·¾¶°¡
> >
> > ÔÚ07-11-8£¬beck917 <beck917在gmail.com> дµÀ£º
> > >
> > > # URL that handles the media served from MEDIA_ROOT.
> > > # Example: " http://media.lawrence.com"
> > > MEDIA_URL = 'http://localhost:8000/media_site/ '
> > >
> > > ÉèÖÃÕâ¸ö¾Í¿ÉÒÔÁË.¾ÍÊÇÒªÓþø¶Ô·¾¶µÄ,ÕâÑù×ÓÒÔºó°Ñ¾²Ì¬·þÎñÆ÷µ¥¶À³öÀ´¾ÍºÜ·½±ãµÄ
> > >
> > > Äã˵¾ø¶Ô·¾¶¿ÉÒÔ,Ó¦¸ÃÊÇÒѾ­ÉèÖú÷þÎñÆ÷µÄ¾²Ì¬»·¾³µÄÁË°É??
> > > ÔÚ07-11-8£¬Ðàľklutz <chumpklutz在gmail.com > дµÀ£º
> > > >
> > > > ÎÒÕÒÈË×öÁËÒ³Ãæ¿ò¼Ü£¬ÀïÃæÓõ½ÁËcssºÍjsÎļþ£¬¿ÉÊÇÎҷŵ½djangoÖÐ×÷Ϊ¸¸Ä£°åʹÓÃʱҳÃæ²»ÄÜÕý³£ÏÔʾ£¬Í¼Æ¬Ò²²»ÏÔʾ
> > > >
> > > > ͼƬÊÇ·ÅÔÚimageĿ¼µÄ£¬cssÊÇ·ÅÔÚcssĿ¼µÄ£¬ÎÒ°ÑÕâЩ·¾¶¸Ä³É¾ø¶Ô·¾¶¾Í¿ÉÒÔ£¬¿ÉÊÇÎÒ²»Äܶ¼Ð´³É¾ø¶Ô·¾¶°¡£¬ÎҼǵúÃÏñ
> > > > Óнâ¾ö°ì·¨£¬´ïÈËÃÇ°ïæ°¡
> > > >
> > > > _______________________________________________
> > > > python-chinese
> > > > Post: send python-chinese在lists.python.cn
> > > > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > > > Unsubscribe: send unsubscribe to
> > > > python-chinese-request在lists.python.cn
> > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > > >
> > >
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese在lists.python.cn
> > > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > >
> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > >
> >
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071108/6ee0f17f/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月08日 星期四 16:26

vicalloy zbirder在gmail.com
星期四 十一月 8 16:26:05 HKT 2007

先把木头的Django Step by Step完整的看一遍吧。
http://www.woodpecker.org.cn/obp/django/django-stepbystep/newtest/doc/

在 07-11-8,朽木klutz<chumpklutz在gmail.com> 写道:
> 我暂时是在django的开发环境下做的用的是django自带的server
>
>
>
> 在07-11-8,beck917 <beck917在gmail.com> 写道:
> > 不行,你那样设置的话是本地路径啊.这样的话就等于静态文件没有经过服务器处理,别人根本没法看到你的图片.
> >
> > 如果你要是用django自带的服务器的话:
> >
> > 在urls.py中加上:
> > urlpatterns += patterns('',
> >     (r'^media_site/(?P.*)$', 'django.views.static.serve ',
> {'document_root': 'media_site'}),
> > )
> > http://www.djangoproject.com/documentation/static_files/
> >
> > 如果是apache的话:
> > 看这篇文章
> >
> http://www.djangoproject.com/documentation/modpython/#serving-media-files
> >
> >
> >
> > 在07-11-8, 朽木klutz <chumpklutz在gmail.com> 写道:
> > >
> > > 我所说的绝对路径就是文件的路径
> > >
> > > MEDIA_URL = 'http://localhost:8000/media_site/ '
> > > 像这种设置的话我能不能设置成"D:/test/static/"这类的文件路径啊
> > >
> > > 在07-11-8,beck917 <beck917在gmail.com> 写道:
> > > >
> > > > # URL that handles the media served from MEDIA_ROOT.
> > > > # Example: " http://media.lawrence.com "
> > > > MEDIA_URL = 'http://localhost:8000/media_site/ '
> > > >
> > > > 设置这个就可以了.就是要用绝对路径的,这样子以后把静态服务器单独出来就很方便的
> > > >
> > > > 你说绝对路径可以,应该是已经设置好服务器的静态环境的了吧??
> > > >
> > > > 在07-11-8,朽木klutz <chumpklutz在gmail.com > 写道:
> > > > >
> > > > >
> 我找人做了页面框架,里面用到了css和js文件,可是我放到django中作为父模板使用时页面不能正常显示,图片也不显示
> > > > >
> > > > >
> 图片是放在image目录的,css是放在css目录的,我把这些路径改成绝对路径就可以,可是我不能都写成绝对路径啊,我记得好像
> > > > > 有解决办法,达人们帮忙啊
> > > > > _______________________________________________
> > > > > python-chinese
> > > > > Post: send python-chinese在lists.python.cn
> > > > > Subscribe: send subscribe to
> python-chinese-request在lists.python.cn
> > > > > Unsubscribe: send unsubscribe to
> python-chinese-request在lists.python.cn
> > > > > Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
> > > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > python-chinese
> > > > Post: send python-chinese在lists.python.cn
> > > > Subscribe: send subscribe to
> python-chinese-request在lists.python.cn
> > > > Unsubscribe: send unsubscribe to
> python-chinese-request在lists.python.cn
> > > > Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
> > > >
> > >
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese在lists.python.cn
> > > Subscribe: send subscribe to
> python-chinese-request在lists.python.cn
> > > Unsubscribe: send unsubscribe to
> python-chinese-request在lists.python.cn
> > > Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
> > >
> >
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to
> python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to
> python-chinese-request在lists.python.cn
> > Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
> >
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to
> python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to
> python-chinese-request在lists.python.cn
> Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>


-- 
Blog http://vicalloy.spaces.live.com/
My googlepage http://vicalloy.googlepages.com/
OldPhoto http://www.lzpian.com/

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月08日 星期四 16:42

vicalloy zbirder在gmail.com
星期四 十一月 8 16:42:03 HKT 2007

wiki似乎挂了
去limodou的Open Book看吧。
http://limodou.51boo.com/book/2/
limodou应当在自己的blog给这个网站加个链接,我要不是去过djangosite,都找不到这个Open Book的网址。

在 07-11-8,vicalloy<zbirder在gmail.com> 写道:
> 先把木头的Django Step by Step完整的看一遍吧。
> http://www.woodpecker.org.cn/obp/django/django-stepbystep/newtest/doc/
>

-- 
Blog http://vicalloy.spaces.live.com/
My googlepage http://vicalloy.googlepages.com/
OldPhoto http://www.lzpian.com/

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号