A Simple Web App for Uploading Images.
The design is very human
This app requires python>=3.8 to run. If you don't have python, install it first.
Other dependencies are listed in requirements.txt
- Clone this repository and switch directory to the cloned repo
git clone https://github.com/Xovert/image-web-app.git
cd image-web-app- In your terminal, enter the following commands
Linux:
python3 -m venv .venv
. .venv/bin/activateWindows:
py -3 -m venv .venv
.venv\Scripts\activateYou should now be running in a python virtual environment
- Install the needed dependencies
pip install -r requirements.txt- Setup Database
flask init-db- Run the App
flask run This application is included with a unit testing scripts, conducted using pytest and flask's built-in testing framework.
Unit test code coverage report can also be generated by using coverage.
Before running unit test, we need to build the app first.
Run, (inside the app root directory)
pip install -e .- Standard Unit Testing
pytest- Unit Test with Verbose Output (Lists of Test names)
pytest -v- Run pytest with coverage in your terminal.
coverage run -m pytest- See Report in Console.
coverage report- Generate HTML Form of Code coverage report.
coverage htmlThe HTML file will be generated in the htmlcov directory. Open htmlcov/index.html in your browser to see the generated report.
Each file name in the report table can be clicked to uncover more details about the code coverage.
Several things that you can config (config must be created at instance/config.py):
SECRET_KEY='<YOUR_SECRET_KEY>'
MAX_CONTENT_LENGTH = <YOUR_SIZE> * 1024 * 1024
MAX_CONTENT_LENGTH can be configured for size limit. The syntax is as follows
<Size> * [KBytes (1024)] * [MBytes (1024)] * <...>
If needed, may add more 1024 for GB, TB, etc.
<Size> is your desired size, for example 5 kb means put 5.
- By Default, there's no default user. Create one first.
- Register user first.
- Then login using the previously registered user.