diff --git a/CHANGELOG.md b/CHANGELOG.md index df122c7..e20c9c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,9 +32,11 @@ ## 0.4 + ## 0.3 + ## 0.2 + Some code refactoring. diff --git a/README.md b/README.md index 152761c..7fabd29 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,29 @@ suitable as a community or team knowledge base. + **Peewee** ORM. + **Markdown** for page rendering. + **Python-I18n**. ++ The database drivers needed for the type of database. ### Optional requirements * **Markdown-KaTeX** if you want to display math inside pages. +## Usage + ++ Clone this repository: `git clone https://github.com/sakuragasaki46/salvi` ++ Edit site.conf with the needed parameters. An example site.conf: + +``` +[site] +name = Salvi + +[database] +directory = /path/to/database/ +``` + ++ Run `flask run`. ++ You can now access Salvi in your browser at port 5000. + + ## Caveats + All pages created are, as of now, viewable and editable by anyone, with no diff --git a/app.py b/app.py index 489bd62..195fb4c 100644 --- a/app.py +++ b/app.py @@ -4,11 +4,10 @@ ''' A simple wiki-like note webapp. -Pages are stored in SQLite databases. +Pages are stored in SQLite/MySQL databases. Markdown is used for text formatting. Application is kept compact, with all its core in a single file. -Extensions are supported (?), kept in extensions/ folder. ''' #### IMPORTS #### @@ -472,7 +471,8 @@ def _inject_variables(): 'app_name': _getconf('site', 'title'), 'strong': lambda x:Markup('{0}').format(x), 'app_version': __version__, - 'math_version': markdown_katex.__version__ if markdown_katex else None + 'math_version': markdown_katex.__version__ if markdown_katex else None, + 'material_icons_url': _getconf('site', 'material_icons_url') } @app.template_filter() diff --git a/migrations/0_6to0_7.py b/migrations/0_6to0_7.py new file mode 100644 index 0000000..f039bb6 --- /dev/null +++ b/migrations/0_6to0_7.py @@ -0,0 +1,17 @@ +from playhouse.migrate import migrate, SqliteMigrator, MySQLMigrator +from peewee import MySQLDatabase, SqliteDatabase +from app import database + +if type(database) == MySQLDatabase: + migrator = MySQLMigrator(database) +elif type(database) == SqliteDatabase: + migrator = SqliteMigrator(database) +else: + print("Unsupported database") + exit() + +with database.atomic(): + migrate( + + ) + diff --git a/templates/base.html b/templates/base.html index b546223..945f45f 100644 --- a/templates/base.html +++ b/templates/base.html @@ -7,8 +7,11 @@ {% block meta %}{% endblock %} - + {% if material_icons_url %} + + {% else %} + {% endif %} {% block json_info %}{% endblock %}