楼主好,我下载下来代码,无法正常启动django程序,可否有详细的说明?
且代码默认为使用utf-8字符集?
你好,文档目前正在完善。能否附上出错截图,方便我这边排查问题?
目前正在重构前端,预计在1月底会有一个新的版本。
我是ubuntu1604, python2和python3都有,默认使用python2.7
问题1:
我看所有代码中,均为声明字符集,带中文的脚本执行直接提示字符问题,我加了# -- coding:utf-8 -- 后该问题解决。
问题2:
执行pip install -r dev.txt 时,提示没有ipython==6.0,仅有版本最高到5.5.0
问题3:
root@ubuntu:/opt/OneStack# python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 364, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 338, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/init.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 108, in populate
app_config.import_models()
File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/opt/OneStack/apps/assets/models.py", line 3, in
from apps.common.models import BaseModel
ImportError: No module named common.models
root@ubuntu:/opt/OneStack#
目前依赖安装完,开始执行syncdb时报错提示没有该模块,但我看代码中应该没问题。
抱歉,这是我的问题。上面的错误,是因为我使用了python2.7、 现在已经切换到python3.5.
但现在runserver后,打开页面默认调整loginurl,但报错:
Page not found (404)
Request Method: GET
Request URL: http://192.168.124.24:9090/login/?next=/
Using the URLconf defined in onestack.urls, Django tried these URL patterns, in this order:
^static/(?P.)$
^$ [name='dashboard']
^user/list/$ [name='user_list']
^user/add/$ [name='user_add']
^user/edit/(?P[0-9]+)/$ [name='user_edit']
^user/detail/(?P[0-9]+)/$ [name='user_detail']
assets/
wiki/
^api-token-auth/
^api-token-refresh/
^rest-auth/
^static/(?P.)$
^debug/
The current path, login/, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
我看了下urls.py, login和logout的被注释了,去掉注释又会报错。