Skip to content

Devallex/Apple-Pi-Website

Repository files navigation

INSTRUCTIONS OUT OF DATE, PLEASE IGNORE

Overview

These instructions show only Linux/MacOS. Windows is probably supported but commands may be slightly different.

Directory Structure

A brief overview of each directory in the repository.

instance — A directory containing all the live data from the website (database, user uploaded files, etc). Sometimes it is useful to delete it in the development enviornment when experiencing issues.

project — All the source code from the website.

core — Scripts which contain a central functionality for the website (start the server, create the database, manage page access, errors, utilities, etc).

modules — Primary website features which have API endpoints and accessible pages, and may interact with the database in requests (users, articles, media, etc).

templates — Scripts which add global variables to jinja templates (headers, footers, breadcrumbs, etc).

website — Static and dynamic web files. Modules can render dynamic ones in responses.

static — Web files which can be directly accessed by going to their path. (Static files can still use template variables.)

Packages

These are some important packages which must be understood.

  • Flask is the web framework used for this application. It can manage incoming requests and deal with them accordingly.
  • Jinja Templates allow data to easily be inserted into text files (like html), can turn generic files into 'rendered pages' with live information
  • SQL Alchemy allows for easy access to the database without executing bulky string sql commands.

Development

Setup

  1. Install Python
  2. Install Python dependencies:
    pip3 install -r requirements.txt
  3. Create config.json file: (You can also do this by running the project)

Config.json File

  • MODE (required): How the server will run (Either dev, debug, or prod).
  • ADMIN_USERNAME (required): The username and role name to the admin account.
  • ADMIN_PASSWORD (required): The password to the admin account.
  • SECRET_KEY (optional): The secret key. If not specified, it will be autogenerated each run.
  • HOST (required in production): The host to use in production.
  • PORT (required in production): The host port to use in production.
  • PROD_PROXY (optional): If true, will use a proxy when running in production. (Do NOT enable this in prod when NOT using a proxy)
  • DUCKDNS_DOMAIN (optional): The domain for DuckDNS (excluding .duckdns.org suffix).
  • DUCKDNS_TOKEN (optional): The token used in DuckDNS.

Running

  1. Start the web server:
    python3 project
  2. Open http://127.0.0.1:5000 to preview the project. (Note: In the event you reloaded the page while you turned the site off, even if you reload again with the site on, it could cache the blank page. You may need to fully force quit your browser and/or clear the cache. It is reccomended to test with FireFox as you can just force quit whenever this happens)

Deployment

  1. Complete setup steps above
  2. In the config.json file, set MODE=prod
  3. Open the logged url to preview the project

About

Unused Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •