zaxlct / imooc-django Goto Github PK
View Code? Open in Web Editor NEW高仿慕课网:py3.5 + Django1.10 + xadmin 搭建的在线课程教育平台
Home Page: http://118.25.37.219
高仿慕课网:py3.5 + Django1.10 + xadmin 搭建的在线课程教育平台
Home Page: http://118.25.37.219
视频看了一遍,收获很大
要想看admin部分是不是只能自己建个服务器?
# coding:utf-8
from datetime import *
import pprint
toWeekday = {1:'一', 2:'二', 3:'三', 4:'四', 5:'五', 6:'六', 7:'日'}
Today = date.today()
weekday = Today.isoweekday() if Today.isoweekday() != 7 else 0
weekList = []
for i in range(7):
isToday = False
theday = Today + timedelta(days=(i-weekday))
if theday == Today:
isToday = True
weekList.append({'daytime': str(theday.day), 'isToday': isToday, 'weekStr':toWeekday[theday.isoweekday()]})
pprint.pprint(weekList)
我通过docker部署插入数据就可以显示中文,自己手动部署中文就显示的是??,然后我在数据库里设置了编码utf8。通过数据库命令查看编码格式也是utf8了,为什么中文还是显示的问号
Wanna check how this project looks like.
首页的用户登录之后点击退出,页面刷新但是用户并未退出。我认为是跟后台登录了有关,一开始是可以退出的,但是我后台登录了之后就不行了。
测试环境:
Python 3.5.0
Django 1.10.5 1.11.2
Pillow 4.0.0 4.1.1
PyMySQL 0.7.10 0.7.11
django-crispy-forms 1.6.1 1.6.1
django-debug-toolbar 1.8 1.8
django-formtools 2.0 2.0
django-pure-pagination 0.3.0 0.3.0
django-simple-captcha 0.4.6 0.5.5
httplib2 0.10.3 0.10.3
olefile 0.44 0.44
pip 9.0.1 9.0.1
setuptools 36.0.1 36.0.1
six 1.10.0 1.10.0
sqlparse 0.2.3 0.2.3
wheel 0.29.0 0.30.0a0
pycharm 环境变量已经更改调用imooc.settingsdev.py
查看了Python最大递归层数是默认的1000层
Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)] on win32
Django 1.10.5
import sys
sys.getrecursionlimit()
1000
最近也是在看视频看资料学习,先给大神个star,膜拜一下。再描述下我遇到问题,我windows本机100%复现操作xadmin导致server crash现象。本人菜鸟,求教大神有没有想法?万分感激
Duplicate steps as an example:
System check identified no issues (0 silenced).
June 28, 2017 - 10:27:52
Django version 1.10.5, using settings 'imooc.settingsdev'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Traceback (most recent call last):
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\smartif.py", line 174, in translate_token
op = OPERATORS[token]
KeyError: 'spec.is_used'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "_pydevd_bundle\pydevd_cython_win32_35_64.pyx", line 1025, in _pydevd_bundle.pydevd_cython_win32_35_64.ThreadTracer.call (_pydevd_bundle/pydevd_cython_win32_35_64.c:20043)
RecursionError: maximum recursion depth exceeded while calling a Python object
Fatal Python error: Cannot recover from stack overflow.
Current thread 0x000016c8 (most recent call first):
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 688 in init
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 603 in compile_filter
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\defaulttags.py", line 879 in create_var
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\smartif.py", line 176 in translate_token
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\smartif.py", line 165 in init
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\defaulttags.py", line 876 in init
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\defaulttags.py", line 944 in do_if
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 516 in parse
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 233 in compile_nodelist
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 191 in init
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\loaders\base.py", line 44 in get_template
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\engine.py", line 134 in find_template
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\engine.py", line 160 in get_template
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\backends\django.py", line 39 in get_template
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\loader.py", line 21 in get_template
File "C:\Users\pengdongz\PycharmProjects\MxOnline_Django\extra_apps\xadmin\filters.py", line 75 in str
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\encoding.py", line 76 in force_text
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\debug_toolbar\panels\templates\panel.py", line 128 in _store_template_info
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\dispatch\dispatcher.py", line 191 in send
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\test\utils.py", line 93 in instrumented_test_render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 208 in render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\backends\django.py", line 66 in render
File "C:\Users\pengdongz\PycharmProjects\MxOnline_Django\extra_apps\xadmin\filters.py", line 76 in str
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\encoding.py", line 76 in force_text
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\debug_toolbar\panels\templates\panel.py", line 128 in _store_template_info
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\dispatch\dispatcher.py", line 191 in send
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\test\utils.py", line 93 in instrumented_test_render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 208 in render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\backends\django.py", line 66 in render
File "C:\Users\pengdongz\PycharmProjects\MxOnline_Django\extra_apps\xadmin\filters.py", line 76 in str
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\encoding.py", line 76 in force_text
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\debug_toolbar\panels\templates\panel.py", line 128 in _store_template_info
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\dispatch\dispatcher.py", line 191 in send
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\test\utils.py", line 93 in instrumented_test_render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 208 in render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\backends\django.py", line 66 in render
File "C:\Users\pengdongz\PycharmProjects\MxOnline_Django\extra_apps\xadmin\filters.py", line 76 in str
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\encoding.py", line 76 in force_text
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\debug_toolbar\panels\templates\panel.py", line 128 in _store_template_info
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\dispatch\dispatcher.py", line 191 in send
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\test\utils.py", line 93 in instrumented_test_render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 208 in render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\backends\django.py", line 66 in render
File "C:\Users\pengdongz\PycharmProjects\MxOnline_Django\extra_apps\xadmin\filters.py", line 76 in str
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\encoding.py", line 76 in force_text
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\debug_toolbar\panels\templates\panel.py", line 128 in _store_template_info
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\dispatch\dispatcher.py", line 191 in send
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\test\utils.py", line 93 in instrumented_test_render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 208 in render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\backends\django.py", line 66 in render
File "C:\Users\pengdongz\PycharmProjects\MxOnline_Django\extra_apps\xadmin\filters.py", line 76 in str
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\encoding.py", line 76 in force_text
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\debug_toolbar\panels\templates\panel.py", line 128 in _store_template_info
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\dispatch\dispatcher.py", line 191 in send
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\test\utils.py", line 93 in instrumented_test_render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 208 in render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\backends\django.py", line 66 in render
File "C:\Users\pengdongz\PycharmProjects\MxOnline_Django\extra_apps\xadmin\filters.py", line 76 in str
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\encoding.py", line 76 in force_text
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\debug_toolbar\panels\templates\panel.py", line 128 in _store_template_info
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\dispatch\dispatcher.py", line 191 in send
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\test\utils.py", line 93 in instrumented_test_render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 208 in render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\backends\django.py", line 66 in render
File "C:\Users\pengdongz\PycharmProjects\MxOnline_Django\extra_apps\xadmin\filters.py", line 76 in str
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\encoding.py", line 76 in force_text
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\debug_toolbar\panels\templates\panel.py", line 128 in _store_template_info
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\dispatch\dispatcher.py", line 191 in send
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\test\utils.py", line 93 in instrumented_test_render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 208 in render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\backends\django.py", line 66 in render
File "C:\Users\pengdongz\PycharmProjects\MxOnline_Django\extra_apps\xadmin\filters.py", line 76 in str
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\encoding.py", line 76 in force_text
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\debug_toolbar\panels\templates\panel.py", line 128 in _store_template_info
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\dispatch\dispatcher.py", line 191 in send
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\test\utils.py", line 93 in instrumented_test_render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 208 in render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\backends\django.py", line 66 in render
File "C:\Users\pengdongz\PycharmProjects\MxOnline_Django\extra_apps\xadmin\filters.py", line 76 in str
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\encoding.py", line 76 in force_text
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\debug_toolbar\panels\templates\panel.py", line 128 in _store_template_info
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\dispatch\dispatcher.py", line 191 in send
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\test\utils.py", line 93 in instrumented_test_render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 208 in render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\backends\django.py", line 66 in render
File "C:\Users\pengdongz\PycharmProjects\MxOnline_Django\extra_apps\xadmin\filters.py", line 76 in str
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\encoding.py", line 76 in force_text
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\debug_toolbar\panels\templates\panel.py", line 128 in _store_template_info
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\dispatch\dispatcher.py", line 191 in send
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\test\utils.py", line 93 in instrumented_test_render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 208 in render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\backends\django.py", line 66 in render
File "C:\Users\pengdongz\PycharmProjects\MxOnline_Django\extra_apps\xadmin\filters.py", line 76 in str
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\encoding.py", line 76 in force_text
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\debug_toolbar\panels\templates\panel.py", line 128 in _store_template_info
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\dispatch\dispatcher.py", line 191 in send
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\test\utils.py", line 93 in instrumented_test_render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\base.py", line 208 in render
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\template\backends\django.py", line 66 in render
File "C:\Users\pengdongz\PycharmProjects\MxOnline_Django\extra_apps\xadmin\filters.py", line 76 in str
...
Thread 0x00001c54 (most recent call first):
File "c:\users\pengdongz\appdata\local\programs\python\python35\Lib\selectors.py", line 305 in _select
File "c:\users\pengdongz\appdata\local\programs\python\python35\Lib\selectors.py", line 314 in select
File "c:\users\pengdongz\appdata\local\programs\python\python35\Lib\socketserver.py", line 237 in serve_forever
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\core\servers\basehttp.py", line 193 in run
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\core\management\commands\runserver.py", line 144 in inner_run
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\autoreload.py", line 226 in wrapper
File "C:\Program Files\JetBrains\PyCharm 172.3095.4\helpers\pydev_pydev_bundle\pydev_monkey.py", line 589 in call
Thread 0x00001754 (most recent call first):
File "c:\users\pengdongz\appdata\local\programs\python\python35\Lib\threading.py", line 297 in wait
File "c:\users\pengdongz\appdata\local\programs\python\python35\Lib\threading.py", line 556 in wait
File "C:\Program Files\JetBrains\PyCharm 172.3095.4\helpers\pydev\pydevd.py", line 112 in _on_run
File "C:\Program Files\JetBrains\PyCharm 172.3095.4\helpers\pydev_pydevd_bundle\pydevd_comm.py", line 293 in run
File "c:\users\pengdongz\appdata\local\programs\python\python35\Lib\threading.py", line 923 in _bootstrap_inner
File "c:\users\pengdongz\appdata\local\programs\python\python35\Lib\threading.py", line 891 in _bootstrap
Thread 0x000024c4 (most recent call first):
File "C:\Program Files\JetBrains\PyCharm 172.3095.4\helpers\pydev_pydevd_bundle\pydevd_comm.py", line 355 in _on_run
File "C:\Program Files\JetBrains\PyCharm 172.3095.4\helpers\pydev_pydevd_bundle\pydevd_comm.py", line 293 in run
File "c:\users\pengdongz\appdata\local\programs\python\python35\Lib\threading.py", line 923 in _bootstrap_inner
File "c:\users\pengdongz\appdata\local\programs\python\python35\Lib\threading.py", line 891 in _bootstrap
Thread 0x00001a00 (most recent call first):
File "c:\users\pengdongz\appdata\local\programs\python\python35\Lib\threading.py", line 297 in wait
File "c:\users\pengdongz\appdata\local\programs\python\python35\Lib\queue.py", line 173 in get
File "C:\Program Files\JetBrains\PyCharm 172.3095.4\helpers\pydev_pydevd_bundle\pydevd_comm.py", line 432 in _on_run
File "C:\Program Files\JetBrains\PyCharm 172.3095.4\helpers\pydev_pydevd_bundle\pydevd_comm.py", line 293 in run
File "c:\users\pengdongz\appdata\local\programs\python\python35\Lib\threading.py", line 923 in _bootstrap_inner
File "c:\users\pengdongz\appdata\local\programs\python\python35\Lib\threading.py", line 891 in _bootstrap
Thread 0x0000267c (most recent call first):
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\autoreload.py", line 280 in reloader_thread
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\autoreload.py", line 299 in python_reloader
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\utils\autoreload.py", line 333 in main
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\core\management\commands\runserver.py", line 106 in run
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\core\management\commands\runserver.py", line 97 in handle
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\core\management\base.py", line 345 in execute
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\core\management\commands\runserver.py", line 58 in execute
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\core\management\base.py", line 294 in run_from_argv
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\core\management_init_.py", line 359 in execute
File "C:\Users\pengdongz\Envs\mxonline_django_env\lib\site-packages\django\core\management_init_.py", line 367 in execute_from_command_line
File "C:/Users/pengdongz/PycharmProjects/MxOnline_Django/manage.py", line 22 in
File "C:\Program Files\JetBrains\PyCharm 172.3095.4\helpers\pydev_pydev_imps_pydev_execfile.py", line 18 in execfile
File "C:\Program Files\JetBrains\PyCharm 172.3095.4\helpers\pydev\pydevd.py", line 1023 in run
File "C:\Program Files\JetBrains\PyCharm 172.3095.4\helpers\pydev\pydevd.py", line 1596 in
pydev debugger: process 7160 is connecting
Performing system checks...
System check identified no issues (0 silenced).
June 28, 2017 - 10:28:43
Django version 1.10.5, using settings 'imooc.settingsdev'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
#5 的详细说明
你好,我用的是12-1那个分支版本,django1.9,但是python manager.py migrate的时候有一个数据库users_banner的表没有生成
先膜拜大神,我也在跟着教程做这个项目,只是视频不全,最后上线这一部分的视频没有。
我项目使用Django自带的服务器运行没问题,想把这个项目部署到Nginx和Uwsgi上面,按照网上相关的博客介绍,也参考了您的博文:http://blog.csdn.net/HeatDeath/article/details/70510847,但是走完所有步骤以后不知道该怎么启动项目了,现在uwsgi 状态没有报错,nginx也正常的启动了,但是不知道要怎么去像`python manage.py runserver`一样启动项目,我不知道是我的代码出了问题,还是落下了步骤,或者其他的原因。
大神可否写一篇博文,或者在github下面介绍下怎样将项目正确的部署到Nginx+Uwsgi上面,并且重新启动,或者再这里指点我一下接下来要做什么,才能像原来的那样运行整个项目。
跪谢大神!
console.log(DateDemo());
function DateDemo(){
var arr = ["日","一","二","三","四","五","六"];
function obj(num){
var date = new Date();
date.setDate(date.getDate() + num);//设置天数
this.daytime = String(date.getDate()) ;
this.isToday= (function(){
var flag = false;
switch(new Date().getDay()+num==new Date().getDay()?String(new Date().getDay()+num):7){
case "0" :
flag = true;
break;
case "1" :
flag = true;
break;
case "2" :
flag = true;
break;
case "3" :
flag = true;
break;
case "4" :
flag = true;
break;
case "5" :
flag = true;
break;
case "6" :
flag = true;
break;
default:
flag = false;
}
return flag;
})(num);
this.weekStr=arr[new Date().getDay()+num]
}
var arrDate = [0,0,0,0,0,0,0];
for(var i=0;i<7;i++){
arrDate[i] = new obj(i);
}
return arrDate;
}
Traceback (most recent call last):
File "", line 5, in
File "C:\Users\maoji\Envs\xadmin\lib\site-packages\django_init_.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\maoji\Envs\xadmin\lib\site-packages\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "C:\Users\maoji\Envs\xadmin\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Users\maoji\Envs\xadmin\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 978, in _gcd_import
File "", line 961, in _find_and_load
File "", line 950, in _find_and_load_unlocked
File "", line 655, in _load_unlocked
File "", line 678, in exec_module
File "", line 205, in call_with_frames_removed
File "C:\Users\maoji\Envs\xadmin\lib\site-packages\xadmin_init.py", line 4, in
from xadmin.sites import AdminSite, site
File "D:\Program Files (x86)\JetBrains\PyCharm 5.0.3\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\maoji\Envs\xadmin\lib\site-packages\xadmin\sites.py", line 10, in
reload(sys)
NameError: name 'reload' is not defined
登陆后台http://127.0.0.1:8000/admin/auth/user/出错。Table 'imooc.auth_user' doesn't exist
这个表确实没有生成。为什么呢?
我设置 list_filter = ['code', 'email', 'send_type', 'send_time'] 为什么在过滤器那块看不下拉框
Django==1.9.8 Python 2.7
大神你的xadmin是不是自己修改过过的啊,跟pip install xadmin下载的不一样,貌似pip下载的在python3的环境下运行会有问题
执行make migrate时候报错,
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.7.10.None.
===========
[root@VM_0_13_centos ~]# pip freeze
Django==2.2.10
django-crispy-forms==1.6.1
django-debug-toolbar==2.2
django-formtools==2.0
django-pure-pagination==0.3.0
django-simple-captcha==0.4.6
httplib2==0.10.3
olefile==0.46
Pillow==4.0.0
PyMySQL==0.7.10
pytz==2019.3
six==1.14.0
sqlparse==0.3.0
=========
[root@VM_0_13_centos ~]# pip install PyMySQL==1.3.13
Looking in indexes: https://mirrors.aliyun.com/pypi/simple
ERROR: Could not find a version that satisfies the requirement PyMySQL==1.3.13 (from versions: 0.3, 0.4, 0.5, 0.6, 0.6.1, 0.6.2, 0.6.3, 0.6.4.dev1, 0.6.4, 0.6.6, 0.6.7, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.7.5, 0.7.6, 0.7.7, 0.7.8, 0.7.9, 0.7.10, 0.7.11, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.9.2, 0.9.3)
ERROR: No matching distribution found for PyMySQL==1.3.13
python 精简版
from datetime import date, timedelta
def getWeekDetail(today=date.today()):
week = today.isoweekday() if today.isoweekday() < 7 else 0
return [{"daytime": str((today + timedelta(days=(index-week))).day).zfill(2), "isToday": index == week, "weekStr": item } for index, item in enumerate([ '日','一', '二', '三', '四', '五', '六']) ]
javascript 版
function getWeekDetail(today = new Date) {
let date = today.getDate();
let week = today.getDay();
let result = [];
for (let i = 0, weekStr; weekStr = ['日', '一', '二', '三', '四', '五', '六'][i++];) {
var tmp = new Date;
tmp.setDate(date + (i - week - 1));
result.push({
"daytime": tmp.getDate().toString().padStart(2, 0),
"isToday": (i - 1) === week,
"weekStr": weekStr
});
}
return result;
}
python 版
from datetime import date, timedelta
def createDateDetail(today=date.today()):
weekList = [ '日','一', '二', '三', '四', '五', '六']
week = today.isoweekday()
week = week if week < 7 else 0
result = []
for i in range(7):
newdate = (today + timedelta(days=(i-week))).day
result.append({
"daytime": str(newdate).zfill(2),
"isToday": i == week,
"weekStr": weekList[i]
})
return result
xadmin不是跟py3不太适配么? py2和py3实在是太难选了,本人想做个自己python小项目,一直纠结于py2还是py3. 和用不用xadmin的问题。也是看了这个教程。能给点意见么?
语言:JavaScript
function computedDaytime(days) {
const date = new Date()
date.setDate(date.getDate() + days)//获取 days 天后的日期
return date.getDate().toString().padStart(2, 0)
}
function computedWeekStrList() {
const weekStrList = ['日', '一', '二', '三', '四', '五', '六']
const today = new Date().getDate().toString().padStart(2, 0)
const week = new Date().getDay()
return weekStrList.map((str, index) => {
let daytime = ''
let isToday = false
if(index === week) {
daytime = today
isToday = true
} else {
daytime = computedDaytime(index - week)
}
return {
daytime,
isToday,
weekStr: str,
}
})
}
console.log(computedWeekStrList())
你好,我把想让一部分用户也有发布课程的权限,所以创建了一个用户组,我该如何在admin后台管理界面
面把用户加入到这个用户组里。
\MxOnline_Django\imooc\urls.py
`import xadmin
from users.views import IndexView
from users.views import LoginView, RegisterView, ActiveUserView, ForgetPwdView, ResetView, ModifyPwdView, LogoutView`
按当前的目录结构这些都import不到吧。应该怎样设置呢?
头部导航中,直接写的模板路径。在pycharm中运行,找不到这些路径。该怎样设置呢?
\MxOnline_Django\templates\base.html
<li> <a href="teachers-list.html">授课教师</a> </li> <li class="active"><a href="org-list.html">授课机构</a></li>
qq多少啊 大屌 有几个问题 要问一下
UnicodeEncodeError: 'ascii' codec can't encode characters in position 5-8: ordinal not in range(128)
manage.py 运行createsuperuser失败 我发现os.environ.setdefault("DJANGO_SETTINGS_MODULE", "imooc.settingsdev") 依然不行
STATICFILES_DIRS 和 STATIC_ROOT的设置为同一目录报错。
修改了STATIC_ROOT目录,可以运行,但是找不到\MxOnline_Django\templates目录下的模板文件。
请问怎样解决?
你好, 我最近也在做类似这个架构的公益项目: https://github.com/kangqiao/lqtripitaka
非常希望您也能够加入龙泉寺大藏经平台.
运行你的项目. 你更改了AUTH_USER_MODEL
怎么创建一个超级管理员账号了?
想登录后台. 看看.
另外能给出一些测试数据到项目中么?
方便 初始化时导入数据库中.
非常感谢!!!
具体的逻辑不懂怎么写。麻烦提供一下demo
您好,我出现过ImportError: No module named courses,这个问题,想问下您出现过么?根本找不到解决办法,代码是和您的一样,我也是按照视频里面那样写的。
大佬牛逼了,你这个mindmanage 软件叫啥名?
对这个项目非常感兴趣,就是担心会不会比起php会不会要更多的机器。额外话题,像这样视频分享网站,性能损耗主要在哪里呢?
您有这个项目的原始HTML代码么?不是修改之后额。求发一份
<?php
/**
* Created by PhpStorm.
* User: LRChang
* Date: 2017/9/1
* Time: 17:12
*/
function weekStrList(){
$znWeekDay = array(
'日','一','二','三','四','五','六'
);
$today = strtotime('today');
$thisWeek = strtotime('last sunday');
$weekStrList = array();
for($i = 0; $i < 7; $i++){
$weekStrList[] = array(
'daytime' => date('d', $thisWeek),
'isToday' => $thisWeek == $today,
'weekStr' => $znWeekDay[$i]
);
$thisWeek += 24*60*60;
}
return $weekStrList;
}
header("Content-Type:text/html; charset=utf-8");
var_dump(weekStrList());
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.