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

  • Home
  • SEARCH
  • 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 7017687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:56:46+00:00 2026-05-27T22:56:46+00:00

I am using django to build a simple website. When you type the base

  • 0

I am using django to build a simple website. When you type the base address (which for now is 127.0.0.1:8000/), I use django to show a view which does some checks and redirects you based on your user privileges. (If you have admin privileges, you go to /admin, if you don’t you go to /home, and if you aren’t logged in you go to /login.)

When I make that HTTP request, I get redirected as I should but I also see the following two errors in my django log:

  1. code 400, message Bad request syntax ('\x16\x03\x01\x00\x95\x01\x00\x00\x91\x03\x01N\xaa\x9c\x08\x96\x7f\x92\xe9Z\x925\xcaY4\xa6\xa5\xab\xf2\x16\xfaT\x89\xe7\x8a\xc3\x99J)6\xfb\xc44\x00\x00H\xc0')
  2. "??N????Z?5?Y4?????T??ÙJ)6??4H?" 400 -

I translated the hex in the first one to be (spaces added for legibility): SYN ETX NUL NUL U SOH NUL NUL Q ETX NUL N 170 156 X r 246 STX 141 214 ? 143 EOT FS j 142 223 s 241 220 < 185 \ \ m 242 &

I can certainly see why the server wouldn’t like that as a request, but I have no idea where it’s coming from.

Any ideas?

Thanks very much.

==============

Here is the code for the view:

def index(request):
    user = request.user
    admin_courses = []

    if (user.is_authenticated()):
        u_id = user.getUserId()
        my_enrollment = Enrollment.objects.filter(user_id=u_id)
        admin_enrollment = my_enrollment.filter(type="ADMIN")
        for enr in admin_enrollment:
            course = Course.objects.get(id=enr.getCourseId())
            admin_courses.append(course)
        if (len(admin_courses)>0):
            return HttpResponseRedirect('/admin')
        else:
            return HttpResponseRedirect('/home')
    return HttpResponseRedirect('/login')
  • 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-05-27T22:56:47+00:00Added an answer on May 27, 2026 at 10:56 pm

    To address your actual question, this occurs if you’re trying to access the django server over https. Switch back to http and that error will disappear.

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

Sidebar

Related Questions

I am using django 1.1.4 and python 2.6.6 with mod_wsgi to build a website
I'm using Django to build a website with a MySQL (MyISAM) backend. The database
I want to build an API service using Django. A basic workflow goes like
I'm willing to build a restful service using Django, I'm coming form RoR background
I develop web applications using Django on Mac OSX 10.6. I use Django's built
I am using django to build an app that is slightly heavy on functionality.
Because I didn't want to use Django's in-build authentication system (maybe I should do,
I've created a simple contact form using the modelformset_factory to build the form in
I'm trying, in vain, to create a simple Django template tag to either show
I am using django-tastypie to build the API for my project. I followed the

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.