2

My application was running fine when I was running it on my local machine. But, as soon as I uploaded it on a server , manage.py is giving the following error -

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

This is the code for manage.py -

import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "chatbot.settings")
try:
    from django.core.management import execute_from_command_line
except ImportError as exc:
    raise ImportError(
        "Couldn't import Django. Are you sure it's installed and "
        "available on your PYTHONPATH environment variable? Did you "
        "forget to activate a virtual environment?"
    ) from exc ***//Here is the error***
execute_from_command_line(sys.argv)

I am using Python 2.7 and Django 1.11

TeeKay
  • 1,025
  • 2
  • 22
  • 60
  • Please do post the code where the error occurs, otherwise we have no idea of whats going on – F. Leone Jan 08 '18 at 10:55
  • @F.Leone I have edited my post. Kindly have a look. – TeeKay Jan 08 '18 at 10:58
  • never seen this kind of error - managment and i don't think you need to use that `from exc` at all. What you maybe wanted to do is a friendly exception managment but i don't think it's done this way (you should use exc to print it?), i'll wait the experts to deny or agree with this. – F. Leone Jan 08 '18 at 12:57

1 Answers1

0

kindly refer this link: How to solve SyntaxError on autogenerated manage.py?

What I have learned from the above link is that if we have two versions of python, then we need to specify the version in which we need to run our application like below:

 python3 manage.py runserver