I am absolutely new to Django and Python and is following a tutorial someone did a few years ago to the letter. I have the following code snippet and when I save it my development Django server give me a error message: File: "/path/to/my/file/apps.py", line 7 def ready(self): TabError: inconsistent use of tabs and spaces in indentation
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'users'
def ready(self):
import users.signals
When I save the file I get the error message above. I also have another file very similar to this one and that one works well. Any idea where I need to change? This code is part of code to create a profile for a user on the site when the user registers on the site.
def
needs to be under name
. You had added an extra space before def
.
To avoid such errors in the future, use a better Text Editor or try out online auto-formatters.
Proper code-
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'users'
def ready(self):
import users.signals