First, the xadmin import Django project
1.1 xadmin Download: https://github.com/sshwsfc/xadmin/tree/django2
or:
Link: https: //pan.baidu.com/s/1VJPsN5GOW_xbiPb8t43oRg
extraction code: nkei
1.2 download archive
1.3 to zip directory, be pip3 install compressed until the installation is successful
Second, the use in the project
2.1 Under the new project extra_apps folder and extract the archive to this folder
2.2 extra_apps Right ------ find Mark Directory As- select Sources Root, is set to SourcesRoot
Under the new 2.3 settings.py
= The INSTALLED_APPS [ ' django.contrib.admin ' , # manage site ' django.contrib.auth ' , # authentication module ' django.contrib.contenttypes ' , # internal frame ' django.contrib.sessions ' , # session management ' Django. contrib.messages ' , # message frame ' django.contrib.staticfiles ' , # map static resource ' my_app ' , # loaded into the global ' vote ', ' Xadmin ' , # xadmin new ' crispy_forms ' # xadmin added ]
Under the new 2.4 settings.py
import sys sys.path.insert(0,os.path.join(BASE_DIR,'extra_apps'))
In 2.5 urls.py new route
url(r'^xadmin',xadmin.site.urls),
2.6 to perform database synchronization
python manage.py makemigrations
python manage.py migrate
2.7 Access browser: http: //127.0.0.1: 8000 / xadmin
Third, before the start of the project can be modified
3.1 Global search keywords:. Python_2_unicode_compatible this method instead of importing from six
E.g:
from django.utils.encoding import python_2_unicode_compatible,smart_text
It is split into
from django.utils.encoding import smart_text from six import python_2_unicode_compatible
3.2 报错:ImportError: cannot import name 'six' from 'django.utils'
Solution:
1.pip3 install six 2. Go to python3.6 / the sum of site Packages Standard Package 3. Copy six.py to django / utils to
3.3 报错:No module named 'django.contrib.staticfiles.templatetags'
Solution:
将from django.contrib.staticfiles.templatetags.staticfiles import static Replaced by: from django.templatetags.static import static To