California Air Resource Board (CARB)
https://oehha.ca.gov/calenviroscreen/report/calenviroscreen-30 https://ww2.arb.ca.gov/homepage https://publiclab.org/questions/samr/04-07-2019/how-to-interpret-pms5003-sensor-values
from django.core.management import call_command
Sensor.objects.all().delete()
call_command('loaddata', 'fixtures/sensors.yaml')
-
Install VirtualBox and Vagrant.
-
Get the code
host:~/dev$ git clone git@github.com:SJVAir/sjvair.com.git
host:~/dev$ cd sjvair.com
- Provision the vagrant box
host:~/dev/sjvair.com$ vagrant up
This will automatically install Python dependencies and run database migrations.
- Shell in and navigate to the project directory
host:~/dev/sjvair.com$ vagrant ssh
vagrant:~$ cd /vagrant
- Create an admin user
vagrant:/vagrant$ python manage.py createsuperuser
6a. Build the front-end
vagrant:/vagrant$ invoke build
6b. Run the development server
vagrant:/vagrant$ python manage.py runserver 0:8000
6c. Run the task workers
vagrant:/vagrant$ python manage.py run_huey
- Visit localhost:8000 in your web browser
vagrant:/vagrant$ pytest
vagrant:/vagrant$ pip install -r requirements/develop.txt
vagrant:/vagrant$ python manage.py migrate
Suspend the box without fully shutting it down (makes vagrant up
faster):
host:~/dev/sjvair.com$ vagrant suspend
Fully shut down the box:
host:~/dev/sjvair.com$ vagrant halt
If you're wanting to access the database in your Vagrant box, e.g., with PgAdmin on your host machine, you'll need to tell Postgres to accept external connections.
-
Tell Postgress to listen on all interfaces
sudo sed -i "s/listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/10/main/postgresql.conf
-
Tell Postgress to accept connections from all interfaces
echo "host all all 0.0.0.0/0 trust" | sudo tee -a /etc/postgresql/10/main/pg_hba.conf