https://github.com/doridoro/deepopinion
A simple Flask application for a CDI position at Deep Opinion.
https://github.com/doridoro/deepopinion
flask-application json makefile sqlite3-database
Last synced: 10 months ago
JSON representation
A simple Flask application for a CDI position at Deep Opinion.
- Host: GitHub
- URL: https://github.com/doridoro/deepopinion
- Owner: DoriDoro
- Created: 2024-12-02T09:55:07.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-05T21:54:31.000Z (about 1 year ago)
- Last Synced: 2025-03-31T14:18:31.255Z (10 months ago)
- Topics: flask-application, json, makefile, sqlite3-database
- Language: HTML
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Deep Opinion
To take a look at some code, I'd like to propose a small practical project. The idea is to
develop a Flask application with the following specifications:
**Main functionality:**
A simple HTML page collects 3 inputs from the user:
- A string identifier.
- Two positive integers: integer_1 and integer_2.
The application returns a list of even integers between these two integers.
**Example:**
If the user enters 1 and 8, the application returns [2, 4, 6, 8].
**Data storage :**
The following data must be stored in a database or structure such as a dataframe:
- The identifier
- The generated list
**Attention to user input:**
Entries must be validated (for example: check that integers are positive, handle cases where
integer_1 > integer_2, etc.).
**Deliverables:**
- Comment your code to make it readable and self-explanatory.
- Update your Git repository with your project. I'll take a look!
**Database:**
The database has been created with the file: `database.py`.
Verify the data inside the deep_opinion.db-database in terminal:
sqlite3 deep_opinion.db
sqlite> .open deep_opinion.db
sqlite> select username, result_list from user_results;
TestUser|[2, 4, 6, 8, 10, 12]
Dean|[4]
Nelly|[2, 4, 6, 8]
sqlite> .quit
For a more detailed approach, use the following:
sqlite3 deep_opinion.db
sqlite> .open deep_opinion.db
sqlite> .tables
user_results
sqlite> pragma table_info(user_results);
0|id|INTEGER|0||1
1|username|TEXT|1||0
2|result_list|TEXT|1||0
sqlite> select username, result_list from user_results;
TestUser|[2, 4, 6, 8, 10, 12]
Dean|[4]
Nelly|[2, 4, 6, 8]
sqlite> .quit
**Installation:**
Clone the GitHub repository with:
```
$ git clone https://github.com/DoriDoro/DeepOpinion.git
$ cd DeepOpinion
```
Create a SECRET_KEY with command:
`$ make generate_secret_key`
and add the SECRET_KEY in a `.env` file on root directory.
Create a virtual environment on Linux machine:
```
$ python3 -m venv .venv
$ .venv/bin/activate
```
Install all dependencies:
`$ pip install -r requirements.txt`
Start the development server:
`$ make server`