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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:52:08+00:00 2026-06-15T04:52:08+00:00

#include doesn’t seem to be working, I get a 500 Internal Server Error. I

  • 0

#include doesn’t seem to be working, I get a “500 Internal Server Error”. I tried the same code without the include, putting all the code in one file, and it works. i’m using the web framwork Flask

header.tmpl

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>$title</title>

        #for $css in $css_sheets
        <link rel="stylesheet" href="../$css">
        #end for
        #for $js in $js_scripts
        <script src="../$js"></script>
        #end for
    </head>
    <body> 

home.tmpl

#include "header.tmpl"
<p id="x">HELLO</p> 
#include "footer.tmpl"

footer.tmpl

    </body>
</html> 

engine.py

from flask import Flask, redirect, request
from Cheetah.Template import Template

app = Flask(__name__)

css_list = ['css/main.css']
js_list = ['js/main.js']
default_title = 'Default Title'

namespace={
    'css_sheets' : css_list,
    'js_scripts' : js_list,
    'title' : default_title
}

@app.route('/')
def main_route():
    return redirect('/index')

@app.route('/index')
def index():
    namespace['title']= 'THIS IS THE INDEX'
    return render("cheetah/home.tmpl", namespace)

def render(template, context):
    """Helper function to make template rendering less painful."""
    return str(Template(file=template, namespaces=[context]))

if __name__ == "__main__":
    app.run()

A secondary question that i have is about the $css and $js variables in header.tmpl:

<link rel="stylesheet" href="../$css"> with $css being set to ‘css/main.css’ works

<link rel="stylesheet" href="$css"> with $css being set to ‘../css/main.css’ fails, it reads it as plain text ‘$css’ instead of getting the value of the variable.

why is that?

  • 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-15T04:52:09+00:00Added an answer on June 15, 2026 at 4:52 am

    The problem was that the path used in the #include is not relative to the template that calls it (home.tmpl), which i thought was the case, but rather the python file (engine.py) which in this case are not in the same location, so the program was not finding the files i was trying to include.

    ../web/engine.py
    ../web/templates/home.tmpl
    ../web/templates/header.tmpl
    ../web/templates/footer.tmpl
    ../web/css/main.css
    ../web/js/main.js
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PHP's curl doesn't seem to include the Host header when doing a request: <?php
I'm following a OpenCV book's tutorial and the following code doesn't work: #include <iostream>
using loadObjectAtResourcePath on GET method, doesn't include my parameters on the requests. for example,
The published code for Palm OS applications doesn't include standard headers, but instead uses
I have fb:comments-count working on my website but it doesn't include nested/threaded comments in
I try to get DomainCollectionView, but Total Count doesn't include in query: public DomainCollectionView<sys_log>
%code top command doesn't include its contents in parser.tab.h file (It should do so,
When I create a Form, the auto-generated code doesn't include an overrided Dispose method.
I'm trying to get the zend framework running, but the include path doesn't like
the code below works fine. However, when a user doesn't include anything in 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.