Optionally, you can use direnv. It loads various environemnt variables and
(in this case) python environment(s) directly on cd-ing. The .envrc file
has already been included. (Mind you, you will still have to install the
environment as stated above, but will not need to manually workon stocks_app
everytime you work on the project)
We will be using postgres for the database. Postgres enables a lot of
additional fields (JSONField, HStoreField, NumericRange, etc) that make
storage and manipulation a lot easier.
You will have to create a postgres user called test, underwhich a database
called stocks, password: test12345.
Keeping common credentials may involved slight more work initially, but later
will help avoid unnecessary conflicts in the settings.py file.
$ sudo apt install postgres
$ sudo -u postgres -i
postgres> psql
postgres=# CREATE USER test with PASSWORD 'test12345';
postgres=# ^C
postgres> createdb stocks_app --password --owner=test
postgres>logout
Once you've set this up, you should be good to go. After we begin hosting, we
will be migrating to a centralized database with the same credentials; this
initial setup will enable you to migrate by just changing the HOST in the
database configuration.
Migrations
Make the initial migrations (along with the single committed one) for the
administrative tables and postgres special field support
Since most of the data is received through the pkl files, you have to ensure that the files that are being fetched and the files being used for rendering are the same. Do change the new script to ensure that the filename to which it is dumping is the same as the one in views.py