简体   繁体   English

Django Web应用程序激活错误

[英]error in activation of django web application

I have created a virtual env that I named "f". 我创建了一个虚拟环境,并将其命名为“ f”。 It has been working fine for the whole time until yesterday when it gave me an error. 直到昨天给我一个错误时,它一直运行良好。

The code is: 代码是:

import _imp  # Just the builtin component, NOT the full Python module
import sys

try:
    import _frozen_importlib as _bootstrap
except ImportError:
    from . import _bootstrap
    _bootstrap._setup(sys, _imp)
else:
    # importlib._bootstrap is the built-in import, ensure we don't create
    # a second copy of the module.
    _bootstrap.__name__ = 'importlib._bootstrap'
    _bootstrap.__package__ = 'importlib'
    try:python manage.py makemigrations

        _bootstrap.__file__ = __file__.replace('__init__.py', '_bootstrap.py')
    except NameError:
        # __file__ is not guaranteed to be defined, e.g. if this code gets
        # frozen by a tool like cx_Freeze.
        pass
    sys.modules['importlib._bootstrap'] = _bootstrap

The result of python manage.py run server is: python manage.py运行服务器的结果是:

File "C:\Users\hp\AppData\Local\Programs\Python\Python36\dj\f\lib\importlib\__init__.py", line 25
    try:python manage.py makemigrations
                    ^
SyntaxError: invalid syntax

Can someone help with the error? 有人可以帮助您解决该错误吗?

You have (accidentally?) pasted in 您粘贴了(偶然?)

python manage.py makemigrations

in that file after try: . try:后在该文件中try:

Remove that and you should be golden – and you should always be able to recreate your virtualenv from scratch anyway. 删除它,您应该会变得很黄金–无论如何,您应该始终可以从头开始重新创建您的virtualenv。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM