Here is a datalogger I have built with an old PCB from a project. The PCB itself has different sensors such as NTC, flow sensors, resistors and leds. I have used the NTCs sensors to retrieve the values every minute and send to a Server.
For this I have used Django and Charisma django, a port from a html template I have made (for more information visit this post).
I placed a sensor outside my window, two inside the room and one inside the radiator. The microcontroller use ADC interrupts to poll the temperature and send it over serialport to a WiFi module. This WiFi module send the data to the server.
Nginx will act as a proxy server and virtualenv will keep different Django’s instances separated.
Create a folder for the web. I will use /opt/DjangoWeb1/ and install there the virtualenv.
Log with postgres user and launch psql.
Create database for Django with postgresql.
CREATE DATABASE djangoweb1;
CREATE USER djangouser1 WITH PASSWORD 'djangopassword1';
ALTER ROLE djangouser1 SET client_encoding TO 'utf8';
ALTER ROLE djangouser1 SET default_transaction_isolation TO 'read committed';
ALTER ROLE djangouser1 SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE djangoweb1 TO djangouser1;
Activate the virtual enviroment and install Django, gunicorn and support for postgresql.
Change the group permissions of the folder so apache or other web servers can work with it. Apply also the default group for new files created. This is usefull when wordpress or other program create new files.