Answer the question
In order to leave comments, you need to log in
Why code hangs because of comments?
Installed python 3.6.8 and django 2.2.7
I tried to open the site with the command python manage.py runserver
, but the code hung and nothing happened. After that, I decided to add print to the manage.py code, but the code continued to hang when I ran it. Next, I removed the comments at the beginning of the manage.py file:
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
and the code worked. Answer the question
In order to leave comments, you need to log in
It's not a comment, it's a shebang, here's what Wikipedia can tell you:
Shebang - in programming, a sequence of two characters: a hash mark and an exclamation mark ("#!") at the beginning of a script file.
When a script with a shebang is run as a program on Unix-like operating systems, the program loader treats the remainder of the line after the shebang as the filename of the interpreter program. The loader runs this program and passes it the name of the script file with the shebang as a parameter.[8] For example, if the full name of the script file is "path/to/script" and the first line of this file is
#!/bin/sh
then the loader executes "/bin/sh" (usually a Bourne shell or compatible command line interpreter) and passes "path/to/script" as the first parameter.
Instead of python write python3. Perhaps he was running under the second version, and not under the third one.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question