1
0

conf.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. """
  2. Blogit configuration module.
  3. Following projects like sphinx or django this project, chooses
  4. python code as a configuration language instead of choosing the
  5. ini, yaml, or what ever DSL for configuration.
  6. """
  7. import datetime
  8. import os
  9. from collections import namedtuple
  10. import tinydb
  11. CONFIG = {
  12. 'content_root': 'content', # where the markdown files are
  13. 'output_to': 'oz123.github.com',
  14. 'raw_content': 'oz123.github.com/writings_raw/content',
  15. 'templates': 'templates',
  16. 'date_format': '%Y-%m-%d',
  17. 'base_url': 'http://oz123.github.com',
  18. 'http_port': 3030,
  19. 'content_encoding': 'utf-8',
  20. 'author': 'Oz Nahum Tiram',
  21. 'editor': 'editor'
  22. }
  23. if not os.path.exists(os.path.join(CONFIG['content_root'])):
  24. os.makedirs(os.path.join(CONFIG['content_root']))
  25. #_db = tinydb.TinyDB(os.path.join(CONFIG['content_root'], 'blogit.db'))
  26. # TODO replace this with a namedtuple for a more convinient access and safety
  27. #_DB = {'posts': _db.table('posts'), 'tags': _db.table('tags'),
  28. # 'pages': _db.table('pages'), 'templates': _db.table('templates') }
  29. #BlogDB = namedtuple('BlogDB', 'posts tags pages templates db')
  30. #DB = BlogDB(posts=_db.table('posts'), tags=_db.table('tags'),
  31. # pages=_db.table('pages'), templates=_db.table('templates'),
  32. # db=_db)
  33. # EDIT THIS PARAMETER TO CHANGE ARCHIVE SIZE
  34. # 0 Means that all the entries will be in the archive
  35. # 10 meas that all the entries except the last 10
  36. ARCHIVE_SIZE = 0
  37. GLOBAL_TEMPLATE_CONTEXT = {
  38. 'media_base': '/media/',
  39. 'media_url': '../media/',
  40. 'site_url': 'http://oz123.github.com',
  41. 'last_build': datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ"),
  42. 'twitter': 'https://twitter.com/#!/OzNTiram',
  43. 'stackoverflow': "http://stackoverflow.com/users/492620/oz123",
  44. 'github': "https://github.com/oz123",
  45. }
  46. KINDS = {
  47. 'writing': {
  48. 'name': 'writing', 'name_plural': 'writings',
  49. },
  50. 'note': {
  51. 'name': 'note', 'name_plural': 'notes',
  52. },
  53. 'link': {
  54. 'name': 'link', 'name_plural': 'links',
  55. },
  56. 'photo': {
  57. 'name': 'photo', 'name_plural': 'photos',
  58. },
  59. 'page': {
  60. 'name': 'page', 'name_plural': 'pages',
  61. },
  62. }