Added an option to specify the default page when a directory is the
[cmless] / bin / cmless.py
CommitLineData
acd291ea
AT
1#!/usr/bin/python3
2
3# (c) 2017 Aaron Taylor <ataylor at subgeniuskitty dot com>
4# See LICENSE file for copyright and license details.
5
6# Python imports
765a8ad0 7import sys, os
acd291ea
AT
8
9# CMless imports
d955cfad 10import config, misc, template
acd291ea
AT
11
12def main():
13 print("Content-Type: text/html;charset=utf-8\n")
14
765a8ad0
AT
15 if os.environ['REQUEST_URI'][-1] == "/":
16 os.environ['REQUEST_URI'] = os.environ['REQUEST_URI'] + config.default_page
17
d955cfad 18 content = misc.load_file(config.site_template_prefix + "/" + config.template_file)
0a58f7f1
AT
19 content = template.page_title(content)
20 content = template.site_title(content)
990c6f79 21 content = template.current_year(content)
1debf034
AT
22 content = template.head_meta_description(content)
23 content = template.head_meta_keywords(content)
0a58f7f1 24 content = template.body(content)
d955cfad 25 print(content)
acd291ea
AT
26
27if __name__ == "__main__":
28 sys.exit(main())