Answer the question
In order to leave comments, you need to log in
How to fix AttributeError: __name__ Django error?
Good afternoon, please tell me how to fix this error, before that everything worked, I started working with another project, after its completion I continued on the previous one and at the first start it gave an error, what should I do?
Watching for file changes with StatReloader
Performing system checks...
Traceback (most recent call last):
File "C:/Users/mkovalev/Desktop/djangoProject/manage.py", line 22, in <module>
main2()
File "C:/Users/mkovalev/Desktop/djangoProject/manage.py", line 18, in main2
execute_from_command_line(sys.argv)
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\core\management\__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\core\management\base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\core\management\commands\runserver.py", line 61, in execute
super().execute(*args, **options)
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\core\management\base.py", line 371, in execute
output = self.handle(*args, **options)
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\core\management\commands\runserver.py", line 96, in handle
self.run(**options)
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\core\management\commands\runserver.py", line 103, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 614, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 599, in start_django
reloader.run(django_main_thread)
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 314, in run
self.run_loop()
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 320, in run_loop
next(ticker)
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 360, in tick
for filepath, mtime in self.snapshot_files():
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 376, in snapshot_files
for file in self.watched_files():
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 274, in watched_files
yield from iter_all_python_module_files()
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 105, in iter_all_python_module_files
return iter_modules_and_files(modules, frozenset(_error_files))
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 118, in iter_modules_and_files
if module.__name__ == '__main__':
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\py\_apipkg.py", line 169, in __getattribute__
return getattr(getmod(), name)
File "C:\Users\mkovalev\AppData\Roaming\Python\Python38\site-packages\py\_error.py", line 43, in __getattr__
raise AttributeError(name)
AttributeError: __name__
Process finished with exit code 1
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question