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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:34:20+00:00 2026-06-15T03:34:20+00:00

In a pyramid application, I defined a static view for serving css/js files and

  • 0

In a pyramid application, I defined a static view for serving css/js files and another one to serve others datas like uploaded files:

config.add_static_view('static', 'static', cache_max_age=3600)
config.add_static_view('uploads', path='/data/uploads')

On the template side, i’m using request.static_url() to access to static files:

<script type="text/javascript" src="${request.static_url('myapp:static/js/jquery-1.8.3.min.js')}"></script>

The problem is I don’t know how to use request.static_url() with the second definition (uploads), what i did never works and crash the app:

${request.static_url('uploads/a_named_file')}

Can you just explain me how to do please?
Thanks by advance.

  • 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-15T03:34:22+00:00Added an answer on June 15, 2026 at 3:34 am

    Looks like you forgot to include the full path:

    ${request.static_url('/data/uploads/a_named_file')}
    

    Static assets are looked up based on the matching path you registered for the static assets. For your two static view registrations, you use the paths static and /data/uploads, respectively. The first one is relative to myapp, but the second one is an absolute path. When using an absolute path for a static view, you need to use the same absolute path when generating static URLs.

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

Sidebar

Related Questions

I'd like to validate uploaded file's size in my Pyramid application using formencode. As
I am serving quite large files from a Pyramid Application I have written. My
For a new (Python) web application with the Pyramid web framework, I'd like to
I'm trying to use the --paste option of uwsgi, to serve a pyramid application,
I am writing a web application with Pyramid and would like to restrict the
I am developing a simple pyramid application where I am using JQuery to do
I am pretty new to python and pyramid. I am working on pyramid application
I have a typical Pyramid web application setup. The application directory (I don't know
With Python web application frameworks such as Flask, webapp2 and Pyramid, how can each
In Pyramid , add_notfound_view(append_slash=True) will cause a request which does not match any view,

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.