eclipse上安装pydev插件http://pydev.org/updates
github上项目https://github.com/myminwang/myblog下载之后运行问题记录
pip install -r D:\eclipse\eclipse-workspace\myblog\requirements.txt
-----------------问题1--------------------------
uwsgi_os = os.uname()[0]
AttributeError: module 'os' has no attribute 'uname'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
./uwsgi.h:2352: error: storage size of `rl_nproc' isn't known
解决: uwsgiconfig.py文件添加import platform
将os.uname替换成platform.uname
-------问题2--------------------------------
command_line
utility.execute()
File "F:\python3\lib\site-packages\django\core\management\__init__.py", line 377, in execute
django.setup()
File "F:\python3\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "F:\python3\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "F:\python3\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "F:\python3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\eclipse\eclipse-workspace\myblog\extra_apps\xadmin\__init__.py", line 4, in <module>
from xadmin.sites import AdminSite, site
File "D:\eclipse\eclipse-workspace\myblog\extra_apps\xadmin\sites.py", line 7, in <module>
from django.utils import six
ImportError: cannot import name 'six'
from django.utils import six ImportError: cannot import name 'six'
解决:将six.py拷贝到F:\python3\Lib\site-packages\django\utils下
------------问题3----------------------------
File "F:\python3\lib\site-packages\django\contrib\auth\models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "F:\python3\lib\site-packages\django\contrib\auth\base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "F:\python3\lib\site-packages\django\db\models\base.py", line 121, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "F:\python3\lib\site-packages\django\db\models\base.py", line 325, in add_to_class
value.contribute_to_class(cls, name)
File "F:\python3\lib\site-packages\django\db\models\options.py", line 208, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "F:\python3\lib\site-packages\django\db\__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "F:\python3\lib\site-packages\django\db\utils.py", line 207, in __getitem__
backend = load_backend(db['ENGINE'])
File "F:\python3\lib\site-packages\django\db\utils.py", line 111, in load_backend
return import_module('%s.base' % backend_name)
File "F:\python3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "F:\python3\lib\site-packages\django\db\backends\mysql\base.py", line 37, in <module>
raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__
version__)
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
解决方法:
F:\python3\Lib\site-packages\django\db\backends\mysql\base.py文件中注释一下内容:
if version < (1, 3, 13):
raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
----------问题4-----------------------------
D:\eclipse\eclipse-workspace\myblog>python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "F:\python3\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_
command_line
utility.execute()
File "F:\python3\lib\site-packages\django\core\management\__init__.py", line 377, in execute
django.setup()
File "F:\python3\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "F:\python3\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "F:\python3\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "F:\python3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\eclipse\eclipse-workspace\myblog\extra_apps\xadmin\models.py", line 11, in <module>
from django.utils.encoding import python_2_unicode_compatible, smart_text ImportError: cannot import name 'python_2_unicode_compatible'
解决方法:在D:\eclipse\eclipse-workspace\myblog\extra_apps\xadmin\models.py注释python_2_unicode_compatible相关的内容
-------------------问题5-------------------
D:\eclipse\eclipse-workspace\myblog>python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "F:\python3\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from
command_line
utility.execute()
File "F:\python3\lib\site-packages\django\core\management\__init__.py", line 377, in execute
django.setup()
File "F:\python3\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "F:\python3\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "F:\python3\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "F:\python3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\eclipse\eclipse-workspace\myblog\extra_apps\xadmin\models.py", line 19, in <module>
from xadmin.util import quote
File "D:\eclipse\eclipse-workspace\myblog\extra_apps\xadmin\util.py", line 24, in <module>
from django.contrib.staticfiles.templatetags.staticfiles import static
ModuleNotFoundError: No module named 'django.contrib.staticfiles.templatetags'
解决方法:
django.contrib.staticfiles.templatetags.staticfiles.static() 在django3.x版本中已移除。将Django版本退回到2.x的版本
----------------项目启动成功----------------
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
http://127.0.0.1:8000/