diff options
Diffstat (limited to 'siteconfig.py')
| -rw-r--r-- | siteconfig.py | 38 | 
1 files changed, 27 insertions, 11 deletions
| diff --git a/siteconfig.py b/siteconfig.py index 4c60674..8917a20 100644 --- a/siteconfig.py +++ b/siteconfig.py @@ -1,28 +1,24 @@  """  siteconfig.py - user editable configuration file  """ +import os  class siteconfig: -    # 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" +    # 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 @@ -32,16 +28,34 @@ class siteconfig:          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 = None  # ["dir1", "dir2", "dir3"] + +    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 = None  # Something random. +    SECRET_KEY = os.urandom(32)  # replace with random number.      # Options for Flask Compress      # see here https://pypi.org/project/Flask-Compress/ @@ -90,4 +104,6 @@ class siteconfig:          '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!"],      } | 
