The official Uruk project wiki script.

ahmadnourallah ba39d9f1ff Update readme file 5 years ago
wiki ec3a39ee7f Use 'get' to fetch list elements 5 years ago
.gitignore 42a42b40bd Add .gitignore file 6 years ago
LICENSE 544d805bc8 Intial commit 6 years ago
README.md ba39d9f1ff Update readme file 5 years ago
babel.cfg fc7f37be8c Intial work 6 years ago
config.py 71d69a5ccf Update config file 5 years ago
main.py fc7f37be8c Intial work 6 years ago
messages.pot d3ee3f916e Add 'Front Page' feature 5 years ago
requirements.txt fc7f37be8c Intial work 6 years ago

README.md

Uruk Wiki

The official Uruk project wiki script.

Project structure

Project uses blueprints to organize sections. Project's files organized using "functional structure". You can take a look at files structure from here:

wiki/
    static/
        css/
        fonts/
        images/
        js/
        media/
        vendors/
    templates/
    translations/
    views/
    \_\_init\_\_.py
    databases.py
    utils.py
LICENSE
README.md
babel.cfg
config.py
main.py
messages.pot
requirements.txt
File/Directory Description
website/ the app's package
website/static/ contains static files
website/static/css/ contains custom css files for the app
website/static/fonts/ contains used fonts in the app
website/static/images/ contains website's images (e.g favicon, errors pictures, website logo)
website/static/js/ contains javascript files
website/static/media/ contains multimedia files (e.g audio files)
website/static/vendors/ contains 3rd party dependencies
website/templates/ contains jinja2 templates
website/views/ contains views for website's blueprints
website/__init__.py the application constructor
website/databases.py contains app's models
website/utils.py contains shared functions between blueprints
LICENSE the project's license (GPL 3)
README.md this file
babel.cfg contains pybabel extractor configurations
config.py the app's configuration variables
main.py the app's runner
messages.pot contains the text in app which must localized
requirements.txt the project's requirements

Installing

Requirements

  • Python 3.6
  • PyPi
  • Flask
  • Flask-Babel
  • Flask-SQLAlchemy
  • Psutil
  • BeautifulSoup (bs4)

Installing requirements

You can install project requirements from requirements.txt file which attached with project files (in root the directory). Invoke this command to install the requirements with pip:

$ [sudo] python3.6 -m pip install -r requirements.txt

Configure project settings

Project must have two config files to run correctly. The first one must be in top-level directory with the name config.py. The file explained well using comments. You can take a look at it from here:

from os import urandom
from os.path import abspath, join, dirname
from flask_babel import gettext
from flask import url_for

LANGUAGES = { # Languages list (key must be the language and the value must be it's direction)
	gettext('English')  :'LTR',
	gettext('Arabic')   :'RTL'
}
PAGES = { # Pages in pages menu in website's navbar
	gettext('Bug tracker')	:'https://urukproject.org/bt/login_page.php',
	gettext('Contribute')	:'https://urukproject.org/en/contribute.html',
	gettext('Dist')		:'https://urukproject.org/dist',
	gettext('Home')		:'https://urukproject.org/',
	gettext('Blog')		:'https://blog.urukproject.org/',
	gettext('Wiki')		:'/'
}

ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif']) # Allowed images extensions
DEFAULT_LANGUAGE = 'EN'
FAVICON = 'images/urukp.png'
FOOTER_MESSAGE = gettext('© 2017 Uruk GNU/Linux • Website Code distributed under the AGPLv3+ • Website media licensed under CC BY-SA 4.')
MAX_CONTENT_PATH = 16 * 1024 * 1024
SECRET_KEY = urandom(24) # The secret key (for signing sessions)
SQLALCHEMY_TRACK_MODIFICATIONS = True
UPLOAD_FOLDER = join(dirname(abspath(__file__)), 'wiki/static/') # Upload folder
WEBSITE_LOGO = gettext('images/logo-e.png')
WEBSITE_NAME = gettext('Uruk Wiki')
WEBSITE_KEYWORDS = gettext('uruk, wiki, uruk wiki, uruk project, uruk linux, linux, URUK, URUK PROJECT') # Website Keywords (for SEO)
FRONT_PAGE = gettext('index') # Front Page url, set to False if none

Also, project must have a config file in instance directory. Create instance/config.py and fill it with the below template:

from hashlib import sha224

ROOT_USER  = {
	'username'      :'USERNAME',
	'email'         :'ADMIN EMAIL',
	'password'      :sha224('ADMIN PASSWORD'.encode('utf-8')).hexdigest(),
	'fullname'      :'ADMIN FULLNAME',
	'description'   :'BRIEF DESCRIPTION ABOUT ADMIN INTERESTS',
	'privilege'     :'admin' # must be always admin
}

SQLALCHEMY_DATABASE_URI = '' # Database URI (Note: you must use sqlite3 database)

Running project

You can run the project using built-in flask development server by using main.py file:

$ [sudo] python3.6 main.py

In production, you can use uwsgi with nginx server. see this tutorial for more information.