我按照网上的步骤
__init__.py 加入:
import pymysql
pymysql.install_as_MySQLdb()
然后运行
python manage.py makemigrations
python manage.py migrate
出现如下错误
E:\workspace\pymysqltest>python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "E:\Python\lib\site-packages\django\core\management\__init__.py", line 367, in execute_from_command_line
utility.execute()
File "E:\Python\lib\site-packages\django\core\management\__init__.py", line 316, in execute
settings.INSTALLED_APPS
File "E:\Python\lib\site-packages\django\conf\__init__.py", line 53, in __getattr__
self._setup(name)
File "E:\Python\lib\site-packages\django\conf\__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "E:\Python\lib\site-packages\django\conf\__init__.py", line 97, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "E:\Python\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 781, in get_code
File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "E:\workspace\pymysqltest\pymysqltest\__init__.py", line 1
import pymysql
^
SyntaxError: invalid character in identifier
请教一下如何处理