473,748 Members | 5,242 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using just the Mako part of Pylons?

I just installed Pylons onto my hosting server so I could try out
templating with Mako, but it seems a little more complicated than that.
From the look of it all, the site seems to want a full Pylons
application. Is it possible to just use regular HTML files with a bit of
the Mako language embedded, or will I actually have to use all aspects
of Pylons?

In other words, can I use *just* Mako (sort of like as a replacement for
PHP) without having to use a framework?

For example, I'd like to just test out the <%include /tag and see it
in action, but the site doesn't seem to be looking for a regular HTML
file (like index.html), it seems to want a "controller ". So is Pylons
overkill for just this? How would I try out *just* Mako?

Thanks!
Jun 28 '08 #1
5 1450
John Salerno wrote:
I just installed Pylons onto my hosting server so I could try out
templating with Mako, but it seems a little more complicated than that.
From the look of it all, the site seems to want a full Pylons
application. Is it possible to just use regular HTML files with a bit of
the Mako language embedded, or will I actually have to use all aspects
of Pylons?

In other words, can I use *just* Mako (sort of like as a replacement for
PHP) without having to use a framework?

For example, I'd like to just test out the <%include /tag and see it
in action, but the site doesn't seem to be looking for a regular HTML
file (like index.html), it seems to want a "controller ". So is Pylons
overkill for just this? How would I try out *just* Mako?

Thanks!
Ok, I figured out how to get it to just use regular HTML files as if it
were a regular, static site. However, the include directive I used
didn't seem to work. I used:

<%include file="separate. html"/>

And it just shows that text in the browser. Am I missing something?
Jun 28 '08 #2
You would need a controller of some sort to connect the web request/
response with your template handling. This is the key task of the web
application layer. This is also the area that WSGI atttemps to
standardize in so far as making the basic objects framework
independent. You can thus supply a generic wsgi app to act as your
controller... see wsgiref package docs. Or, you can of course use any
app framework of your choice.

But, as a small, ultra-lightweight templating system that can be used
in a web context or as standalone, you should really take a look at
Evoque Templating: http://evoque.gizmojo.org/

All the power of any fully featured text-based templating system and
then some (no constraints on template file names or formats,
restricted execution, automatic XSS protection, ...) while being also
incredibly fast. And the simplicity of the system means you can learn
it really quickly, and remember it...

Btw, you may be interested in a small example of wsgi based app that
uses evoque -- one of the examples of how to use evoque under various
contexts:
http://evoque.gizmojo.org/ext/

mario
Jun 28 '08 #3
John Salerno a écrit :
I just installed Pylons onto my hosting server so I could try out
templating with Mako, but it seems a little more complicated than that.
Err... Actually, it's certainly a little less complicated than that.
First point: Mako is totally independant from Pylons. Second point: you
don't need any web server to use Mako - it's just another Python package.
Jun 30 '08 #4
Bruno Desthuilliers wrote:
John Salerno a écrit :
>I just installed Pylons onto my hosting server so I could try out
templating with Mako, but it seems a little more complicated than that.

Err... Actually, it's certainly a little less complicated than that.
First point: Mako is totally independant from Pylons. Second point: you
don't need any web server to use Mako - it's just another Python package.
Well, so far I have installed Pylons onto my web server, but a test Mako
template isn't rendering, it just prints the text to the browser.
There's got to be something more to do to get it all hooked up so that
it works.
Jul 1 '08 #5
John Salerno wrote:
Bruno Desthuilliers wrote:
>John Salerno a écrit :
>>I just installed Pylons onto my hosting server so I could try out
templating with Mako, but it seems a little more complicated than that.

Err... Actually, it's certainly a little less complicated than that.
First point: Mako is totally independant from Pylons. Second point:
you don't need any web server to use Mako - it's just another Python
package.

Well, so far I have installed Pylons onto my web server, but a test Mako
template isn't rendering, it just prints the text to the browser.
There's got to be something more to do to get it all hooked up so that
it works.
What do you mean by "the text"? The source code of the template? A
random insult? The generated page? If it's the last, you forgot to set a
Content-Type header.
--
Jul 1 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

121
10130
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
14
2111
by: B Williams | last post by:
I am stuck on an assignment that uses classes and functions. I am receiving numerous errors when I try to run a test program to see if I wrote it correctly. Can someone please point me in the right direction. These are two of the error messages I am receiving. error C2660: 'Invoice::setPartNumber' : function does not take 1 arguments error C3861: 'setItemQuantity': identifier not found This is the code. Thsnks in advance
48
2473
by: northband | last post by:
Hi, I am interested in re-writing my website in Python vs PHP but have a few questions. Here are my specs, please advise as to which configuration would be best: 1.Dell Poweredge Server, w/IIS, currently Windows but considering FreeBSD 2. Site consists of result pages for auctions and items for sale (100 per page) 3. MySQL (Dell Poweredge w/AMD) database server connected to my web server
0
1126
by: sqad | last post by:
Hi, I am making a javascript call to google maps to get the geocodes of an address. Ok, so its trivial to get the latitude/longitude, but now I want to pass that data via the Pylons MVC framework so that my controllers have access to them. I could get the lat/long by instead going through HTTP via a webservice call, but new problem comes up - how do I now hand off the c variables to the javascript function.
2
4024
by: Adam Kubica | last post by:
Hello. I have pylons 0.96 (SVN) and current SQLAlchemy (0.3.10), and I have bug that doesn't exist earlier. My connection code: <code> import sqlalchemy.mods.threadlocal from sqlalchemy import DynamicMetaData, objectstore
4
1514
by: Mage | last post by:
Hello, I don't want to be impolite, just in short: I am thinking about leaving RoR and coming back to Python. I've missed the last two years in Python, however I have been subscribed to this list and there are not too many e-mails about Pylons in my mailbox. On my Gentoo the latest Pylons ebuild has date "jul 2007" or something like last summer. It has testing keywords both for x86 and amd64. (No
1
1184
by: sniipe | last post by:
Hello, I have a question about framework pylons - how to run(in paster) webpages over https? Is it possible, or not? Best regards
2
1613
by: Chris Babcock | last post by:
Is there a cheap way to convert Myghty/Mako templates to Kid/Genshi? There's some code written for Pylons that I want to incorporate into a TurboGears 2 project and Genshi templates are more likely to behave themselves with the tools I'm used to. Chris
0
2157
by: trihaitran | last post by:
I am reading chapter two of the Pylons book. In the text I am told to run: $ python virtualenv.py --no-site-packages env This is what I got back: $ python virtualenv.py --no-site-packages env New python executable in env/bin/python Installing setuptools........... Complete output from command env/bin/python -c "#!python
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.