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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:51:09+00:00 2026-05-31T19:51:09+00:00

I am following a tutorial for django , im hosting my project in a

  • 0

I am following a tutorial for django, im hosting my project in a free hosting for testing,

the hosting is working fine with python ,and the django shell for example,

but I cannot see the proper data in my index.html or have acces to the /admin

so I think is a problem with a wrong path?,

so please advice on this noob issue,

this is the folder where I have my files /home/mako34/www/blog

here my code:

I suppose settings is configured correctly for the db as it is creating the sqlite db, and the necessary folders

settings.py

import os
*
* configure connection do db, etc
*

ROOT_URLCONF = 'blog.urls'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(os.path.dirname(__file__),'templates'), # creates a absolute path
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'blog',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)

urls.py

from django.conf.urls.defaults import patterns, include, url

# Uncomment the next two lines to enable the admin:
 from django.contrib import admin
 admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'blog.views.home', name='home'),
    # url(r'^blog/', include('blog.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    (r'^, 'blog.views.index'), #<------------------- index/root entry
    # Uncomment the next line to enable the admin:
     url(r'^admin/', include(admin.site.urls)),


)

index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>My Blog</title>
    </head>

<body>
    <H1>Test Django</H1>
    <div id="content">
    {% block content %}
    {% endblock %}
    </div>
</body>

</html> 

So what im i missing?

so i can see my index html with data [as now it shows the tags {% block content %}
{% endblock %}
and no data in them

and cannot have acces to http://mako34.alwaysdata.net/blog/admin/

thanks!

  • 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-31T19:51:10+00:00Added an answer on May 31, 2026 at 7:51 pm

    Your URLs should look like this:

    urlpatterns = patterns('',
         url(r'^admin/', include(admin.site.urls)),
         url(r'^', 'blog.views.index'),
    )
    

    Note that the index URL you want to work is now wrapped in a url() call. Also, the index URL now follows the admin URL so that urls referencing /admin are handled by the admin URL, not the catch all index URL you’ve defined.

    URL handlers work on first match. Your url(r'^') matches EVERYTHING, so doesn’t give a chance for the admin url to work. You should probably change it to url(r'^$') which will match a ‘no-path’ URL, not a ‘every url’. Note the addition of the $ sign, marking the end of a pattern.

    Edit:

    Ok, now I understand your problem better. What you’re trying to do, is to deploy a django app at a particular server path that requires a prefix in the URL path.

    This is what is usually a standard URL:

    http://www.example.com/
    http://www.example.com/admin/
    http://www.example.com/index/
    

    Instead, this is what you’re trying to do:

    http://www.example.com/myapp/
    http://www.example.com/myapp/admin/
    http://www.example.com/myapp/index/
    

    Django usually expects your app to be deployed at the root URL, with no path. The path is used to find which internal django app should handle the request.

    There are two ways for you to solve your problem. The first, and what I’d consider the correct way, is to use the sites framework as described here.

    The other, is to add the prefix to all of your URLs in urlpatterns like so:

    urlpatterns = patterns('',
         url(r'^blog/admin/', include(admin.site.urls)),
         url(r'^blog/$', 'blog.views.index'),
    )
    

    But you will also need to remember to add your ‘blog’ prefix to several settings that expect URLs like LOGIN_REDIRECT etc etc.

    What you really should do though, is make django work at the URL: mako34.alwaysdata.net and forget the /blog/ altogether, but modifying apache to redirect all requests to mod_wsgi.

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

Sidebar

Related Questions

I'm following the Django-CMS introductory tutorial and have got everything working up to the
I've been following the Django tutorial , and so far everything's been working as
I'm working through the Django tutorial and receiving the following error when I run
I am following Django tutorial from django website. There I see a regular expression
I am currently working through the tutorial on Django's website. Upon completing the following
I'm following the django tutorial at Django by example in http://www.lightbird.net/ . In the
I'm following the tutorial on the Django website but I'm trying to expand upon
Using: Ubuntu 11.04 Django 1.3 Python 2.7 Following the tutorial at Writing your first
I just installed Solr and Haystack for a Django project I'm working on. Following
I've been following the django tutorial over at https://docs.djangoproject.com/en/dev/intro/tutorial03/ but I've hit a brick

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.