https://github.com/myminwang/myblog项目运行问题解决

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/


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 211,265评论 6 490
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,078评论 2 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 156,852评论 0 347
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,408评论 1 283
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,445评论 5 384
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,772评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,921评论 3 406
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,688评论 0 266
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,130评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,467评论 2 325
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,617评论 1 340
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,276评论 4 329
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,882评论 3 312
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,740评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,967评论 1 265
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,315评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,486评论 2 348

推荐阅读更多精彩内容