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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:18:17+00:00 2026-05-15T02:18:17+00:00

The following is the result of CherryPy and css pathing problems I have recently

  • 0

The following is the result of CherryPy and css pathing problems I have recently posted, both of which have been answered, but another problem has arisen.

I have a html page which I preview in a browser (via. editor/IDE) and which calls a css file from a css folder in parallel with my application folder (containing main.py and My.html file). For this I use relative pathing in the html header…

 <link rel="stylesheet" href="..\css\commoncss.css" type="text/css">

All good so far. However, when I run Main.py, the css file cannot be found, and the page looks a mess 🙁 The CP configuration file includes the following line…

tools.staticdir.root = "my\app\folder"  # contains Main.py and My.html

but no other staticdir declarations because CP should be looking for ..\css\commoncss.css relative to the static root folder (am I right?)

I could have my CSS folder as a top-level folder (then I could use href=”/css/commoncss” and declare /css as a staticdir), but that’s ugly. Alternatively the CSS folder could be a subfolder of the app folder, but I really need the freedom to be able to put the .css file(s) in a different path if possible (could be common to more than one app.).

I really would like to crack this problem, because otherwise it means the html designer cannot use the same template as the Python programmer without changing the href directive.

Any help would be appreciated.

Alan

  • 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-15T02:18:18+00:00Added an answer on May 15, 2026 at 2:18 am

    but no other staticdir declarations
    because CP should be looking for
    ..\css\commoncss.css relative to the
    static root folder (am I right?)

    You can’t reach into your physical file directory (static dir) via URLs, nor should you want to.

    Cherrypy is looking for the css file relative to your HTML file in the URL hierarchy. If your HTML file is at root, then this won’t work. If it’s at, say: /stuff/blarg.html, then it would go down to the root and look for the css folder.

    I think it’s easier to just give an absolute path, because it’s reasonable to stipulate that the css directory be in a known location: “/css/commoncss.css“

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

Sidebar

Related Questions

Say I have a query which returns the following result: | val | type
I have the following result from geoPlugin http://www.geoplugin.net/json.gp?ip=64.90.182.55 : geoPlugin({ geoplugin_request:64.90.182.55, geoplugin_status:200, geoplugin_city:New York,
Hi I have the following code: boolean result = someexpression(); if(!result) { System.out.println(False...); }
I have a following structered DOM result, getting after a POST event: <root> <config>
The following call returns a result in WinXP but not on Win7: using (WebClient
I have the following result set from a join of three tables, an articles
i have following json format { status: ACTIVE, result: false, isworking: false, margin: 1,
I have the following regex: /[]*(?<name>.*)[\]*?\s*[<(](?<email>\w.*)[>)]/.match(\The Boss\ <daboss@aol.com>) and get the following result: name
I have a table which contains the following data: ID In Out 1 100.00
SQL Server 2005 I have the following result set: ID name prop value --------------------------

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.