Best Flask open-source libraries and packages

Server storage

Flask webserver with a database for uploading files (uses OAuth)
Updated 7 months ago

MIT License Python Version GitHub issues

icon

Cloud Storage Server

A simple Flask server to upload and store multiple users' files, using OAuth for Google authentication.
Explore readme »

Go to issues »

Installation

This project requires Python and some modules, for the full list check the requirements.txt file.

  1. Clone the repository:

    git clone https://github.com/mwkm00/server-storage.git
  2. Install Python:

    sudo apt install python3

    Windows: Download Installer

  3. (Recommended) install a fresh Python Virtual Enviroment in the project directory:

    python -m venv .venv

    Remember to activate it before step 4.

  4. Install the project's dependencies:

    pip install -r requirements.txt
  5. Set up your secret.env file:
    It is necessary to store your Google Cloud Client ID, Client Secret and the App Secret in the secret.env file for the server to read them. Customize this dummy secret.env file with your own values:

    GOOGLE_CLIENT_ID="do-not"
    GOOGLE_CLIENT_SECRET="use-me"
    APP_SECRET="dummy"

    Do not share your secret.env file!

    (back to top)

Usage

By default, the server is hosted locally, with the Flask debug feature turned on.

Run the project:

python webserver.py

Or set up the project for use of the flask command in the terminal

Go to http://localhost:5000 to log in using your Google account.
If port 5000 is already occupied, change the app.run() function call in webserver.py accordingly:

if __name__ == "__main__":   
 if not os.path.isdir(UPLOAD_DIR):   
     os.mkdir(UPLOAD_DIR)   
 with app.app_context():   
     db.create_all()   
 app.run(debug=True) #, port=<new_port>) <--- CHANGE THIS VALUE   

Purpose

Although this project is a good starting point for anyone wanting to experiment with Flask and OAuth, do not use it or its design in a production enviroment. For now, it is a mock project lacking many safety features.

That much to say, with some GUI changes, it might serve as a great self-hosted home cloud or even (with some modification) a private over-the-internet cloud.

Suggested improvements will be listed in the Issues tab.

For a very basic implementation, check out the Legacy branch

Showcase

icon

Contributing

I would love for this project to become a playground for trying out and learning new things, so contributions are very welcome!
How you can contribute:

  1. Find or file an issue you'd like to address. Please try to keep issues reasonably small, focusing on one aspect.

  2. Create a new branch:

    git checkout -b your-fork-name
  3. Make some changes and commit them to the branch:

    git commit --signoff -m 'changes description'
  4. Push the branch to your fork on GitHub:

    git push origin your-fork-name
  5. Test your app:

    pytest

    Note, that currently implemented tests are very basic, for major restructuring they will require changes.
    Check the formatting:

    black --check .
  6. Make a pull request on GitHub to the experimental branch. Make sure to # the issue you are addresing

(back to top)

License

Distributed under the MIT License.