Skip to content

Flask-based files uploading service for LERG files

Notifications You must be signed in to change notification settings

osya/LERGFilesUpload

Repository files navigation

LERG Files Upload

Introduction

Build Status Coverage Status

It is a Flask & Jinja2-based webApp for LERG files (some special CSV files) uploading by admin and downloading these files by customers via API.

As though only admins will log in to this app the register link and register endpoint disabled. Admin login&password: admin:adminadmin

Used technologies:

  • Python & Flask & Jinja2
  • Testing: pytest, factory-boy, and WebTest
  • Assets management: NPM & Webpack
  • Travis CI

Installation

First, set your app's secret key as an environment variable. For example, example add the following to .bashrc or .bash_profile.

    export LERG_FILES_UPLOAD_SECRET='something-really-secret'

In your production environment, make sure the LERG_FILES_UPLOAD_ENV environment variable is set to "prod".

Then run the following commands to bootstrap your environment.

    git clone https://github.com/osya/LERGFilesUpload
    cd LERGFilesUpload
    pip install -r requirements/dev.txt
    npm install
    npm run webpack:deploy

Migrate your database and run python manage.py server

Migrations

Whenever a database migration needs to be made (for example, once you have installed your DBMS). Run the following commands:

    python manage.py db init
    python manage.py db migrate

This will generate a new migration script. Then run python manage.py db upgrade to apply the migration.

For a full migration command reference, run python manage.py db --help.

Usage

To upload a file press "Choose File" button, choose file and press "Open" button. File will be uploaded and appears in Operation Log.

To download log press "Log Download" button

Shell

To open the interactive shell, run python manage.py shell

By default, you will have access to app, db, and the User model.

Tests

To run all tests, run

    python manage.py test