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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:38:48+00:00 2026-05-29T04:38:48+00:00

I have a Pyramid app that I’ve been developing and viewing locally through http://localhost:6543

  • 0

I have a Pyramid app that I’ve been developing and viewing locally through http://localhost:6543, which is what the paster docs suggest. There are various assets, for example .css files, available in a static directory, which I have made available through config.add_static_view('static','static') When I view it through localhost everything works fine, my .css files are loaded, and all is well. However, when I view the app through my computer’s hostname/IP address, the static assets aren’t loaded.

A freshly-installed Pyramid paster scaffold displays the same behavior. I’ve gone through and followed the Pyramid narrative documentation through the step called viewing the application, and everything works as is described. But change the URL in the location bar from http://localhost:6543 to http://my.host.name:6543 and the style sheets don’t get loaded.

The assets are available; type http://my.host.name:6543/static/pylons.css on a freshly-created Pyramid paster scaffold and you can read the contents of the css, but it’s not loaded when the root page is loaded. Firebug indicates that those resources are requested, but never received.

What’s going on here, and how can I make sure that my static assets are loaded when I request them through something other than localhost?

Edit to add some code. This is from the Pyramid starter paster scaffold, which I haven’t modified and which exhibits the same behavior my application does; it can be considered a minimal example.

from package’s __init__.py:

def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(settings=settings)
    config.add_static_view('static', 'static', cache_max_age=3600)
    config.add_route('home', '/')
    config.scan()
    return config.make_wsgi_app()

complete views.py:

from pyramid.view import view_config

@view_config(route_name='home', renderer='templates/mytemplate.pt')
def my_view(request):
    return {'project':'TestProject'}

relevant line from templates/mytemplate.pt:

<link rel="stylesheet" href="/static/pylons.css" type="text/css" media="screen" 
charset="utf-8" />

Where static/pylons.css is in the static directory under the root.

Again, opening http://0.0.0.0:6543 in the browser (FF10) works fine, http://my.host.name:6543 displays the page without style information; but http://my.host.name:6543/static/pylons.css gives me the style sheet text.

  • 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-29T04:38:50+00:00Added an answer on May 29, 2026 at 4:38 am

    Without being able to look at your code it’s a bit hard to answer this question. My guess based on a similar experience is that you might not be using the static_url method inside your templates. Below is another way to reference static assets in your templates:

    <link rel="stylesheet" href="${request.static_url('app:static/css/app.css')}">
    

    Are you using that? Using anything else will certainly cause the behaviour you are seeing.

    There seems to be a problem if the application is installed to a path that is not the document route. You can see this discussed here.

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

Sidebar

Related Questions

I have a Pyramid app that uses Chameleon for its templates. I would like
I have a Pyramid app and apache with mod_wsgi and I'm trying to make
I have a pyramid which has 5 vertex and 18 indices. As I want
I am working on a pyramid web application that uses SQLAlchemy. I have a
I have deployed a Pyramid app using mod_wsgi. I have setup the python path
I would like to create a Pyramid app with an orm which I am
Ok here is the problem in brief. I do have a pyramid setup that
I have a very simple Pyramid app (my first one) and I'd like to
I have a NewRequest event handler (subscriber) in Pyramid which looks like this: @subscriber(NewRequest)
Have just started using Visual Studio Professional's built-in unit testing features, which as I

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.