aboutsummaryrefslogtreecommitdiffstats
path: root/siteconfig.py
blob: 8917a20766278dd1e2159d26e8bdf919629dee3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
"""
siteconfig.py - user editable configuration file
"""
import os


class siteconfig:
    # BACKGROUND SETTINGS #
    # These don't need to be changed

    # This setting is required, don't change it unless you're running
    # things in different directories
    BASE_DIR = "./templates/site/"

    # Add your desired mimetypes to the csv file
    MIMETYPES = {}
    with open('mimetypes.csv') as f:
        for line in f.readlines():
            ext, mime = line.strip().split(',')
            MIMETYPES.update({ext: mime})

    # This reads your omit file.
    # Entries should be the full path from the site directory.
    # For example "dontread.txt" in this project is entered as
    # 'thoughts/rants/donread.txt'
    RSS_OMIT = []
    with open('omit') as f:
        for line in f.readlines():
            RSS_OMIT.append(BASE_DIR + line.strip())

    DEFAULT_SITE_DIRS = []
    for x in os.listdir(BASE_DIR):
        if os.path.isdir(BASE_DIR + x) and not x.startswith("."):
            DEFAULT_SITE_DIRS.append(x)

    # REQUIRED SETTINGS #

    DOMAIN = "example.net"  # Your site here!
    HOME_TITLE = "WELCOME"
    LINKS_FILE = ".links"  # ".lnx" if you like
    DESC_FILE = ".description"  # ".desc"
    DEFAULT_MIMETYPE = "application/octet-stream"
    # ^This usually prompts a browser to download a file if the mime
    # type is unknown. A good alternative might be "text/plain"

    # OPTIONAL SETTINGS #

    # Be default, ALL directories in the site toolbar are contained in
    # ./templates/site/. You can change this to only specific directories, but
    # these still have to be in ./templates/site

    MAIN_SITE_DIRS = sorted(
        DEFAULT_SITE_DIRS
    )  # ["dir1", "dir2", "dir3"]

    # Set a custom secret key. If not set, it will be generated
    # Most of the time, you don't need to set this!
    SECRET_KEY = os.urandom(32)  # replace with random number.

    # Options for Flask Compress
    # see here https://pypi.org/project/Flask-Compress/
    COMPRESS_MIMETYPES = list(MIMETYPES.values())

    # Options for Flask Caching
    # https://flask-caching.readthedocs.io/en/latest/#configuring-flask-caching
    cache_config = {
        'CACHE_TYPE': "SimpleCache",
        'CACHE_DEFAULT_TIMEOUT': 10,
        # You should only fill ONE of the sections below
        # uswgi
        'CACHE_UWSGI_NAME': None,
        ##
        # memcache
        'CACHE_MEMCACHED_SERVERS': None,
        'CACHE_MEMCACHED_USERNAME': None,
        'CACHE_MEMCACHED_PASSWORD': None,
        ##
        # redis
        'CACHE_REDIS_HOST': None,
        'CACHE_REDIS_PORT': None,
        'CACHE_REDIS_PASSWORD': None,
        'CACHE_REDIS_DB': None,
        'CACHE_REDIS_URL': None,
        'CACHE_REDIS_SENTINELS': None,
        'CACHE_REDIS_SENTINEL_MASTER': None,
        'CACHE_REDIS_CLUSTER': None,
        ##
        # filesystem
        'CACHE_DIR': None,
        # add more options as needed from the URL above
    }

    # RSS Settings
    rss_channel_config = {
        'TITLE': "RSS Feed for example.net",
        'LINK': "http://127.0.0.1:5000/",
        'DESCRIPTION': "My example feed",
        'LANGUAGE': "en-us",
        'PUBDATE': "",
        'LASTBUILDDATE': "",
        'DOCS': "https://git.mjfer.net/ezcms.git/",
        'GENERATOR': "EZCMS",
        'AUTHOR': "editor@example.net",
        'WEBMASTER': "webmaster@example.net",
        # Max amount of paragraphs to print in each description
        'DESCRIPTION_LENGTH': 3,
        # File extensions to include in RSS updates
        'RSS_FILE_EXT': ["txt", "html", "html!"],
    }