Question

How to runserver django in ubuntu 17.04 i have created django app but when i try to run server the terminal says invalid syntax

i run this code i terminal

$ python3 manage.py runserver ‘my ip address:8000’

and the result is

Traceback (most recent call last): File “manage.py”, line 22, in <module> execute_from_command_line(sys.argv) File “/usr/local/lib/python3.5/dist-packages/django/core/management/init.py”, line 364, in execute_from_command_line utility.execute() File “/usr/local/lib/python3.5/dist-packages/django/core/management/init.py”, line 308, in execute settings.INSTALLED_APPS File “/usr/local/lib/python3.5/dist-packages/django/conf/init.py”, line 56, in getattr self._setup(name) File “/usr/local/lib/python3.5/dist-packages/django/conf/init.py”, line 41, in _setup self._wrapped = Settings(settings_module) File “/usr/local/lib/python3.5/dist-packages/django/conf/init.py”, line 110, 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 986, in _gcd_import File “<frozen importlib._bootstrap>”, line 969, in _find_and_load File “<frozen importlib._bootstrap>”, line 958, in _find_and_load_unlocked File “<frozen importlib._bootstrap>”, line 673, in _load_unlocked File “<frozen importlib._bootstrap_external>”, line 669, in exec_module File “<frozen importlib._bootstrap_external>”, line 775, in get_code File “<frozen importlib._bootstrap_external>”, line 735, in source_to_code File “<frozen importlib._bootstrap>”, line 222, in _call_with_frames_removed File “/home/aditya/test_django_app/testsite/testsite/settings.py”, line 28 ALLOWED_HOSTS = [my ip address] ^ SyntaxError: invalid syntax


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Put ALLOWED_HOSTS = '*' and then run your command line like python3 manage.py runserver 0.0.0.0:8000 if you’re running in the same machine.