Python Flask application to receive and save images over POST requests.
This repository has been archived on 2021-01-14. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
BBaoVanC 9910bc279c
Add imageName field to request a specific name to save to
2020-09-15 17:24:36 -05:00
.github Add GitHub-specific README.md which links Gitea 2020-09-07 20:31:24 -05:00
.gitignore Remove uploadkeys encryption features 2020-09-03 21:44:58 -05:00
LICENSE Initial commit 2020-08-31 16:43:58 -05:00
README.md Rewrite installation section in README.md 2020-09-08 00:39:48 -05:00
configtest.py Remove leftover debug print statements in configtest.py 2020-09-15 16:35:50 -05:00
functions.py.default Add newline after block comments at beginning 2020-09-06 15:24:20 -05:00
imgupload.py Add imageName field to request a specific name to save to 2020-09-15 17:24:36 -05:00
keyctl.py Deduplicate code in keyctl.py and add comments 2020-09-04 19:44:46 -05:00
requirements.txt Remove uploadkeys encryption features 2020-09-03 21:44:58 -05:00
settings.py.default Add proper shebangs and block comments 2020-09-04 10:47:20 -05:00
uwsgi.ini.default Increase processes in uwsgi.ini.default 2020-09-12 19:48:42 -05:00

README.md

imgupload

What is imgupload?

imgupload is a Flask + uWSGI application to serve as an all-purpose image/file uploader over POST requests.


FAQ

Where can I send bug reports and feature requests?

You can create an issue here.

How do I use this program?

See Installation

I want to make a pull request. Where should I do that?

First, fork this repository. If you don't have an account on my Gitea site yet, you can either create one, or sign in using your GitHub account. Commit your changes to your fork, and then create a pull request.


Installation

Using uWSGI

Note: replace www-data with whatever user your webserver runs as.

  1. Make /srv/imgupload: sudo mkdir /srv/imgupload
  2. Change ownership of /srv/imgupload: sudo chown www-data:www-data /srv/imgupload
  3. Enter www-data user: sudo su www-data
  4. Change directories to /srv/imgupload: cd /srv/imgupload
  5. Clone the repository: git clone https://git.bbaovanc.com/bbaovanc/imgupload.git
  6. Enter the imgupload directory: cd imgupload
  7. Create a virtualenv: python3 -m venv env
  8. Enter the virtualenv: source env/bin/activate
  9. Install dependencies: python3 -m pip install -r requirements.txt
  10. Leave the www-data user: exit
  11. Copy the default uWSGI configuration: sudo cp /srv/imgupload/uwsgi.ini.default /etc/uwsgi/apps-available/imgupload.ini
  12. Modify /etc/uwsgi/apps-available/imgupload.ini to your preferences
  13. Enable imgupload: sudo ln -s /etc/uwsgi/apps-available/imgupload.ini /etc/uwsgi/apps-enabled/
  14. Restart uWSGI: sudo systemctl restart uwsgi
  15. Set up your webserver to proxy the uwsgi.sock

Example NGINX location block:

location /upload {
    include uwsgi_params;
    uwsgi_pass unix:/srv/imgupload/uwsgi.sock;
    client_max_body_size 25M;
}

Using Flask development server

Setup

$ git clone https://git.bbaovanc.com/bbaovanc/imgupload.git
$ cd imgupload
$ python3 -m venv env
$ source env/bin/activate
$ pip3 install -r requirements.txt

Run

$ export FLASK_APP=imgupload.py
$ flask run

License

imgupload is licensed under the GPLv3 license. For more information, please refer to LICENSE