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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:20:03+00:00 2026-05-16T15:20:03+00:00

I am trying to template-ize my Apache httpd configuration for deployment to different environments

  • 0

I am trying to template-ize my Apache httpd configuration for deployment to different environments and I would like to use the Python language Cheetah application to do so. However, I am having difficulty with the command line cheetah program and I believe its a combination of my misunderstanding Cheetah along with a lack of documentation.

My goal is to have a single httpd.conf template file and substitute variables from an environment specific definition file.

httpd.tmpl:

Listen $HTTP_PORT
...
#if $ENABLE_HTTPS == true
<Virtual Host *:$HTTPS_PORT>
    ...
</VirtualHost>
#end if

production.env:

HTTP_PORT=34120
HTTPS_PORT=34121
ENABLE_HTTPS=true

What is the command line needed to fill this Cheetah template? I’ve used:

cheetah f --oext conf --debug httpd

But obviously prod.env is not read as an input file. Adding an #include to the top of my template file:

#include "prod.env"

And none of my names are found:

Cheetah.NameMapper.NotFound: cannot find 'APACHE_PORT'

This is not the ideal situation anyway, because I want the ability to specify the name/value mapping file on the command line for each invocation of cheetah.

Thanks!

EDIT: I am aware that I can write a python script to perform the file reading and then substitute using the Cheetah API. However, I’m looking for a way to use the command line to fill my template.


SOLVED

Thanks to the documentation link provided by @pyfunc I now understand how to accomplish this. The main issue is to supply --env on the cheetah command line which passes the current environment variables to cheetah. These environment variables must be exported first however.

  • 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-16T15:20:04+00:00Added an answer on May 16, 2026 at 3:20 pm

    Cheetah wraps each chunk of #include text inside a nested Template object.

    Use

    #include raw "prod.env"
    

    also

    #set global $HTTP_PORT="34120"
    

    To include different env files, you will have too templatize that too.

    Please look at the following for examples that should help you.

    • http://packages.python.org/Cheetah/dev_guide/output.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement a template class that would be able to tell
I am trying to re-use a XSL template, and place other templates within this
I'm trying to build template tags that take use a dictionary in settings.py to
This is the provided function template I'm trying to use: template <class Process, class
I'm trying to make template.render() (import was: from google.appengine.ext.webapp import template ) use a
I am trying to create template/BaseActivity class for other developers to use, as a
I am trying to use template design pattern so I use abstract class to
im trying to call a c++ template function in objective c that looks like
I'm practicing C# with wpf and I'm trying to use template formatting. At this
I am trying to use template meta-programming to determine the base class. Is there

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.