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 6629361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:14:58+00:00 2026-05-25T22:14:58+00:00

I am pretty new to django but experienced in Python and java web programming

  • 0

I am pretty new to django but experienced in Python and java web programming with different frameworks.
I have made myself a nice little django app, but I cant seem to make it match http://www.mysite.com as opposed to http://www.mysite.com/myapp.

I have defined urls and views in my urls.conf which is currently not decoupled from the app (don’t mind that).

urlpatterns = patterns('myapp.views',
  (r'^myapp/$', 'index'),
  (r'^myapp/(?P<some_id>\d+)/global_stats/$', 'global_stats'),
  (r'^myapp/(?P<some_id>\d+)/player/(?P<player_id>\d+)/$', 'player_stats'),
)

All this works like a charm. If someone goes to http://www.mysite.com/myapp they will hit my index view which causes a http redirect to my “correct” default url.

So, how can I add a pattern that will do the same as (r’^myapp/$’, ‘index’) but without the /myapp–that is, http://www.mysite.com should suffice?

I would think this would be very basic stuff… I tried adding a line like:

(r'^$', 'index'),

however this throws me in a loop…

Hope you django gurus out there can clarify this for me!

  • 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-25T22:14:58+00:00Added an answer on May 25, 2026 at 10:14 pm

    This sounds strange.

    Your latest attempt should work, but what I normally do – put

    urlpatterns = patterns('',
        (r'^$', lambda r: HttpResponseRedirect('myapp/')),
        ...
    )
    

    This scales better when you start adding new apps.

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

Sidebar

Related Questions

Im pretty new to Java Web Services, but I cant find a good explanation
I am pretty new to django, but have many years experience coding in the
I am pretty new to php, but I am learning! I have a simple
I am using django and as I am pretty new I have some questions.
We are starting a web project with Django (and are pretty new to this),
I'm pretty new to web development and I have an idea for something that
I'm pretty new to regular expressions. I have a requirement to replace spaces in
I am pretty new to Django. I want the name of my models to
It appears to me that Django and Pylons have different ideas on how middleware
I have an existing Django application with a pretty typical model implementation that's backed

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.