Error from 'site'

I’m new to Django and I keep getting an error that says:
AttributeError: module ‘base.admin’ has no attribute ‘site’

This is from:
urlpatterns = [
path (‘admin/’, admin.site.urls) ]

I have checked and I do have the latest instalment of Django as I saw that this could be the reason why it isn’t working but I still am unable to get through this problem.

This is not the right syntax for your url specification.
What tutorial or doc are you working from?

I’ve been watching several youtube tutorials and copied them exactly and yet i’m confused how it doesn’t work for me.

If you have “copied it exactly”, then it’s an error in the video, because that syntax is wrong.

You’re better off starting with the official Django docs. I suggest you begin with the official Django tutorial.

Also, two side notes:

  1. When posting a file like this from a tutorial, it’s often helpful to post the entire file. There’s always the possibility that the error message being reported is a result of something wrong earlier in that file.
  2. When posting code here, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted, which is critical with Python.
1 Like

I apologize, I was mistaken, I misread what you had posted here. The syntax of that line is correct, the issue would be somewhere else.

Side note: When posting code (or templates, error messages, etc) here, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted.

If you’re still having a problem, please post the entire contents of that urls.py file.
Also include your INSTALLED_APPS setting from your settings.py.