Car85 / neo_chronos_backend

separated backend for newChronos app
0 stars 0 forks source link

flask_corrs, environment variables, 404 #2

Open agtic opened 2 months ago

agtic commented 2 months ago

Some additional things I needed to get it to run:

pip install flask_cors  
export FLASK_APP=app.interfaces.rest.api
export PYTHONPATH=$PYTHONPATH:$PWD # where the current directory is the root proj directory, neo_chronos_backend

After that flask starts. But when I try to open it in my browser I get a 404

% flask run
 * Serving Flask app 'app.interfaces.rest.api'
 * Debug mode: off
2024-08-06 16:25:38 INFO:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
2024-08-06 16:25:38 INFO:Press CTRL+C to quit
2024-08-06 16:25:46 INFO:127.0.0.1 - - [06/Aug/2024 16:25:46] "GET / HTTP/1.1" 404 -
2024-08-06 16:25:47 INFO:127.0.0.1 - - [06/Aug/2024 16:25:47] "GET /favicon.ico HTTP/1.1" 404 -
2024-08-06 16:26:05 INFO:127.0.0.1 - - [06/Aug/2024 16:26:05] "GET / HTTP/1.1" 404 -
2024-08-06 16:26:20 INFO:127.0.0.1 - - [06/Aug/2024 16:26:20] "GET / HTTP/1.1" 404 -
2024-08-06 16:26:20 INFO:127.0.0.1 - - [06/Aug/2024 16:26:20] "GET /favicon.ico HTTP/1.1" 404 -
2024-08-06 16:26:28 INFO:127.0.0.1 - - [06/Aug/2024 16:26:28] "GET / HTTP/1.1" 404 -
Car85 commented 2 months ago

Hello @agtic please, check the change of 4d74820

You have two request now

curl -X POST -H "Content-Type: application/json" -d '{"tolerance":"5","setpoint_min":"86","setpoint_max":"130", "setpoint_offset_summer":"25","setpoint_offset_winter":"29", "mode_change_delta_temp":"2","mode_switch_lockout_time":"-1", "cascade_time":"11"}' http://localhost:5000/add_settings

&&&& filter by id in the table settings of chronos.db ` curl -X GET http://localhost:5000/settings/1

`

It's just a begin, but it is with python3.12.

If you think it's appropriate, you can start sending me domain functionalities, and I'll try to resolve them here so @fardin-developer can consume them from his frontend.

I'll try to do it faster from now on.

Thank you, guys.

fardin-developer commented 2 months ago

@Car85 Have you completed the upgrade of the backend? I have separated the backend and also createde the frontend. Now I'm considering upgrading from Python 2.7 to 3.0. Should I proceed with the upgrade, or have you already taken care of it? and please contact me in linkdein or whatsapp

Car85 commented 2 months ago

No, I haven't completed all the functionalities of Chronos yet. I’ve just set up a backend project structure for Python 3.12 using more modern technologies. The two queries are related to the Settings in the frontend panel. I might be wrong, but I think it’s better to build the Chronos functionalities from scratch rather than updating the old backend. However, you have more experience, @fardin-developer , so maybe your approach is better. Don't worry about my time because this has allowed me to learn new technologies. I'll reach out to you in the next few days on WhatsApp. Cheers, mate.