Forums

File "manage.py", line 14) from exc ^ SyntaxError: invalid syntax

I want to create a username and password for the Superuser and you place this code:

python manage.py migrate

But I have this error:

File "manage.py", line 14 ) from exc ^ SyntaxError: invalid syntax

If I run the server, this command is written: python manage.py runserver This error comes:

Traceback (most recent call last): File "/usr/lib/python3.5/site-packages/django/core/management/base.py", line 316, in run_from_argv self.execute(args, cmd_options) File "/usr/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 60, in execute super().execute(args, options) File "/usr/lib/python3.5/site-packages/django/core/management/base.py", line 353, in execute output = self.handle(*args, options) File "/usr/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 67, in handle if not settings.DEBUG and not settings.ALLOWED_HOSTS: File "/usr/lib/python3.5/site-packages/django/conf/init.py", line 57, in getattr self._setup(name) File "/usr/lib/python3.5/site-packages/django/conf/init.py", line 44, in _setup self._wrapped = Settings(settings_module) File "/usr/lib/python3.5/site-packages/django/conf/init.py", line 107, in init mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib/python3.5/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 985, in _gcd_import File "<frozen importlib._bootstrap>", line 968, in _find_and_load File "<frozen importlib._bootstrap>", line 943, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 985, in _gcd_import File "<frozen importlib._bootstrap>", line 968, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked ImportError: No module named 'DEGNet'

seems like you have for example a manage.py that is written for python2.7 and running it with python3.5

@conrad Please excuse me I am a newbie How can I make sure of this? Do you know the solution?

Use the same version of Python that your web app uses to run manage.py. So, if your web app is using Python 3.6, run python3.6 manage.py migrate or, if you're using a virtualenv for your web app, make sure that the virtualenv is activated.

I fix this error "File ""manage.py", line 16, from exc SyntaxError: invalid syntax.

  1. python3 manage.py check -->(0 silenced)
  2. python3 manage.py makemigrations
  3. python3 manage.py migrate (you can see any changes running)

Adding Your Polls Application

  1. python3 manage.py startapp polls
  2. python3 manage.py runserver
  3. python3 manage.py check (System check identified no issues (0 silenced).
  4. (your-account).pythonanywhere.com/polls

[edited by admin: formatting]

this helps me very much thank you

Glad to hear that!

On everyChange, Please usually reload the webpage from the web tab

@Genesisapps -- what are you trying to do? (What commands do you run?) Did you already check things suggested in the discussion above (like checking Python version that you use in your web app)?