Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8338451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:35:43+00:00 2026-06-09T04:35:43+00:00

I am creating a basic blog with only basic python and the taggit module,

  • 0

I am creating a basic blog with only basic python and the taggit module, it resides at http://127.0.0.1:8000/ (have to put random spaces in so i can submit) when i run ./manage.py syncdb it executes correctly and when i runserver it returns no erros. The problem is when i actually visit the website. Than this happens…

SyntaxError at /
invalid syntax (admin.py, line 4)

This is displayed in the webbrowser..

Here is the traceback:

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/

Django Version: 1.4.1
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'taggit',
 'MainBlog')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response
  101.                             request.path_info)
File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py" in resolve
  298.             for pattern in self.url_patterns:
File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py" in url_patterns
  328.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
  323.             self._urlconf_module = import_module(self.urlconf_name)
File "/Library/Python/2.7/site-packages/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/Users/zackbaker/MyBlog/MyBlog/urls.py" in <module>
  5. admin.autodiscover()
File "/Library/Python/2.7/site-packages/django/contrib/admin/__init__.py" in autodiscover
  29.             import_module('%s.admin' % app)
File "/Library/Python/2.7/site-packages/django/utils/importlib.py" in import_module
  35.     __import__(name)

Exception Type: SyntaxError at /
Exception Value: invalid syntax (admin.py, line 4)

Anyways any help that could be given would be awesome! Thank you guys so much!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:35:45+00:00Added an answer on June 9, 2026 at 4:35 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a basic database utility class in Python. I'm refactoring an old module
My current class is planning on creating a basic networked game, but we have
I'm creating a basic database application in WPF, and I have started using the
I'm creating a basic student/course script. I have 3 models I'm working with: Student,
I am creating a blog for my site using Word Press. The only part
I'm creating a basic Swing applcation. I have jTextPane and a button. If the
I am creating a basic GUI with the Windows API and I have run
I am creating a basic GUI with the Windows API and I have run
I currently do a lot of WPF development and have started creating some basic
I'm creating a basic blog app with rails/mongoid backend and an iOS client that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.