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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:14:24+00:00 2026-06-17T00:14:24+00:00

I have a beginner question with URL Dispatch or Traversal. What I am trying

  • 0

I have a beginner question with URL Dispatch or Traversal. What I am trying to do, is use Mako renderer to render my views. So I have this folder /includes/ where all the html and css and javascript is. Here is my Pyramid main code:

from pyramid.config import Configurator

def main(global_config, **settings):
    config = Configurator(settings=settings)
    config.add_static_view('includes', 'includes', cache_max_age=3600)
    config.add_renderer(".html", "pyramid.mako_templating.renderer_factory")  
    config.add_route('home', '/')
    config.scan()
    return config.make_wsgi_app()

And these are my views:

@view_config(route_name='home', renderer='index.html')
def my_view(request):
    return {'name':'Netherdrake'}

@view_config(name = 'login', renderer='login.html')
def login(request):
    return {'name':'Netherdrake'}

The problem is, when I access ip:port/login the site works fine, but when I try ip:port/login/ the css, javascript and images don’t work. The reason is, my absolute paths become invalid.

And here is my login.html snippet (which is mako template really) while login without /:

 <link href="includes/css/twitter/bootstrap.css" rel="stylesheet">
  <link href="includes/css/base.css" rel="stylesheet">
  <link href="includes/css/twitter/responsive.css" rel="stylesheet">
  <link href="includes/css/jquery-ui-1.8.23.custom.css" rel="stylesheet">
  <script src="includes/js/plugins/modernizr.custom.32549.js"></script>

And here it is while Im going for login/ path (site is broken in this case, no css, images, js…):

  <link href="includes/css/twitter/bootstrap.css" rel="stylesheet">
  <link href="includes/css/base.css" rel="stylesheet">
  <link href="includes/css/twitter/responsive.css" rel="stylesheet">
  <link href="includes/css/jquery-ui-1.8.23.custom.css" rel="stylesheet">
  <script src="includes/js/plugins/modernizr.custom.32549.js"></script>

The login.html is in /includes too.

How can I fix this, and make it work under both paths, with and without slash? I tried traveral and url dispatch, and problem is same in both.

  • 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-17T00:14:26+00:00Added an answer on June 17, 2026 at 12:14 am

    All your hrefs should begin with an initial slash.

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

Sidebar

Related Questions

Absolute beginner question: I have a template file index.html that looks like this: ...
This is a beginner level question for asp.net MVC I have the following code
I'm a total beginner so I apologize if this question is elementary. I have
am sorry for this dumb beginner question, but i have a real problem understanding
I have another beginner's question that hopefully someone can help with. I'm trying to
This is a very beginner question. I have tried to search for advice but
Sorry for this extreme beginner question. I have a string variable originaltext containing some
I'm sure this is a completely obvious beginner question, but trying to find answers
I am beginner in PHP and Apache. I am trying to use URL Rewriting
This seems like a pretty beginner question; however, I have no idea what 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.