[Answered ]-Django error when visiting site: syntax error (admin.py, line 4)

2👍

Line 4 of your admin.py is

from admin.site.register(Post)

This is a Python syntax error. It should be simply

admin.site.register(Post)

which calls the appropriate method to register your Post class with Django’s admin site.

Incidentally, the from keyword in Python is used to import something into your current module. You should make sure you have the line

from django.contrib import admin

somewhere in lines 1 through 3 of admin.py (probably line 1!), to make sure admin is defined correctly by the time you get to line 4.

Leave a comment