作者aiweisen (教授...我想毕业)
看板Python
标题[问题] (更新)apache+django 无法显示custom useer模组
时间Thu Jun 25 15:00:31 2015
请问一下
我使用的是apache2.4 + django1.4 +python1.7
但是同样专案 我使用runserver去执行
在後台管理那边可以看到客制化的使用者模组(userprofile)
http://imgur.com/a/U6z9H#1
但是若在apache上执行相同的专案
却看不到userprofile
http://imgur.com/a/U6z9H#0
这问题卡好久了 请问有人知道这有可能是哪边出问题吗?
官网也有看到这一方面的教学
但是我中间那边Authentication with mod_wsgi 那段看不太懂
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/apache-auth/
在setting中也有设定
AUTH_PROFILE_MODULE = 'account.UserProfile'
而下面是我apache的设定档
WSGIScriptAlias /wsgi "c:/mms/mms/wsgi.py"
Alias /static/ "c:/Python27/lib/site-packages/django/contrib/admin/static/"
<VirtualHost *:9000>
ServerName 192.168.10.11
<Directory "c:/mms/">
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
--
1F:推 MicroGG:干他选的上台北市长我表演自含懒叫 12/14 18:55
作者 MicroGG (美少女骨科秘书长) 站内 Gossiping
标题 Re: [新闻] 山难国赔寒蝉效应 医师:出游尽量隐藏
时间 Mon Jun 8 00:56:17 2015
2F:推 Formosan: 含的到吗?好奇………06/08 01:11
尽力了,无法..
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 140.138.150.24
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1435215640.A.608.html
3F:推 billy0131: 客制化是改static file? 有重新collectstatic? 06/25 19:39
对不起 现在才回
collectstatic 有做过 他有产生admin资料夹在我的mms专案
重新执行syncdb也有看到出现account_userprofile
其它自己新增的模组(cms、locupdate)有在後台看到 就唯独userprofile没看到
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table locupdate_visit_server
Creating table cms_message_receivers
Creating table cms_message
Creating table cms_message_attach
Creating table account_userprofile
还有 我每次重开apache server後 第一次连线都会出现下列问题
http://i.imgur.com/cGNWE00.png
TRACEBACK
http://codepad.org/rag0YLW6
从连第二次就可以正常进入後台管理
不知道跟这有没有关系
另外下面是我的account的moedel
http://codepad.org/JEh2NOei
4F:→ uranusjr: 谁教你把 admin 放在 models.py 的啦, 请放在 admin.py 06/29 13:06
但是我django是1.4版 不像1.7有自己的admin.py
还是说要自己建立admin.py?
又或者要apache + django 1.7才会正常运作?
=====================================================
刚刚试着仿照1.7的格式 自己建立的admin.py 把admin丢进去就过了
请问这是为什麽阿= =?
5F:→ uranusjr: 解释起来很麻烦, 反正你记得这样做就对了 06/29 14:28
是不是可以理解成apache跟django连结後 需要透过admin来执行
但apache找不到admin.py这个档案 导致无法正常执行admin 指令
不过想问一下有没有相关的网址在说明apache & admin这一部分?
6F:→ uranusjr: 其实和 Apache 没什麽关系, 主要是 models.py 的读入顺 06/29 23:03
7F:→ uranusjr: 序(在 1.7 之前)是 non-dterministic, 所以无法保证你 06/29 23:04
8F:→ uranusjr: 写在 models.py 里的 admin 会在正确的时候被执行 06/29 23:04
9F:→ uranusjr: 这个顺序是 implementation-defined 所以在本机一直可以 06/29 23:04
10F:→ uranusjr: 但换到 Apache 与 mod_wsgi 就有可能改变 06/29 23:05
11F:→ uranusjr: 应该理解成「在本机没问题是运气好, 本来就不该这样做」 06/29 23:06
谢谢解释 这样我大概了解了
※ 编辑: aiweisen (140.138.238.19), 06/30/2015 10:43:07