A Python-Django web application enabling users to upload, share, and display data from their environmental monitoring sites via the app's ODM2 database. Data can either be automatically streamed from Internet of Things (IoT) devices, manually uploaded via CSV files, or manually entered into forms.
I was trying to config the project myself by following the Python 2.7 section of the guide.
I've done:
Install Python 2.7 and all the packages needed from the Ubuntu Repository.
Create a PostgreSQL Database and User called odm and odmer
Create the odm2 database for PostgreSQL with the Database Script
I did it with this:
su - postgres psql
postgres=# \i sc.sql # sc.sql was the script I copied from github
Create a Python Virtual Environment to install all the project requirements in an isolated Python instance.
I use conda activate ODM2DataSharingPortal instead
Clone the ODM2 Data Sharing Portal from our GitHub repository.
Start the initial django configuration by copying the file ./src/WebSDL/settings/settings_template.json to settings.json, and fill out the values for each attribute with your server and database information.
And Here comes my setting.json
{
"secret_key": "tanklab",
"debug_mode": "True",
"static_root": "/static/",
"host": "localhost",
"host_alt": ["localhost", "8000"],
"password_email_sender": "\"Password Recovery\" <{{password recovery email}}>",
"notify_email_sender": "\"Site Data Alert\" <{{data loss notification email}}>",
"email_host": "{{email server address}}",
"influx_query": "{{influx db server address}}/query?u={influx db user}&p={{influx db password}}&db=envirodiy&q=SELECT%20time,%20DataValue::field,%20UTCOffset::field%20FROM%20%22uuid_{result_uuid}%22%20WHERE%20%22time%22%20%3E=%20%27{last_measurement}%27-{days_of_data}d",
"influx_updater_query": {"url":"{{inlfux db server address}}/write?u=webtsa_root&p=yellowmousewithasmalltinyhat&db=envirodiy&precision=s", "body": "uuid_{result_uuid} DataValue={data_value},UTCOffset={utc_offset}.0 {timestamp_s}"},
"tsa_url": "{{time series analyst address}}",
"sensor_data_period": "{{days it takes for the data to be considered stale}}",
"databases": [
{
"name": "default",
"schema": "odm",
"engine": "django.db.backends.postgresql_psycopg2",
"user": "odmer",
"password": "12345",
"host": "localhost",
"port": "5432"
},
{
"name": "odm2",
"schema": "odm2",
"engine": "django.db.backends.postgresql_psycopg2",
"user": "odmer",
"password": "12345",
"host": "localhost",
"port": "5432"
}
],
"hydroshare_oauth": {
"client_id": "{{hydroshare client id}}",
"client_secret": "{{hydroshare client secret}}",
"redirect_uri": "hydroshare/oauth/"
},
"crontab_log_file": "{{log file for crontab jobs}}",
"crontab_user": "{{crontab user}}",
"google_api_conf": {
"api_key": "{{api key for leafpack taxon spreadsheet}} (AIzaSyD_uxlkaHEd9h6FK7ULSWxkLbJ4ovySfOI)",
"files": {
"taxon_spreadsheet": "{{leafpack taxon spreadsheet id}} (12CVnLB7XVkOFUf4sL3Nd_oawZCr4BhoxfjL2P8IpZww)"
}
}
}
Since I want to config it step by step, so I didn't actually finish filling it.
Howerver when I run the next step's command ./src/manage.py update_controlled_vocabularies the error occurs:
(ODM2DataSharingPortal) root@ubuntu:/opt/ODM2DataSharingPortal# ./src/manage.py update_controlled_vocabularies
Traceback (most recent call last):
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "auth_user" does not exist
LINE 1: SELECT "auth_user"."affiliation_id" FROM "auth_user" WHERE "...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./src/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/apps/registry.py", line 122, in populate
app_config.ready()
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/contrib/admin/apps.py", line 24, in ready
self.module.autodiscover()
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/utils/module_loading.py", line 47, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/ODM2DataSharingPortal/src/dataloaderinterface/admin.py", line 9, in <module>
from dataloaderinterface.forms import SiteSensorForm
File "/opt/ODM2DataSharingPortal/src/dataloaderinterface/forms.py", line 17, in <module>
user_affiliations = [
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/db/models/query.py", line 274, in __iter__
self._fetch_all()
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/db/models/query.py", line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/db/models/query.py", line 144, in __iter__
return compiler.results_iter(tuple_expected=True, chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1094, in results_iter
results = self.execute_sql(MULTI, chunked_fetch=chunked_fetch, chunk_size=chunk_size)
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1142, in execute_sql
cursor.execute(sql, params)
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/db/backends/utils.py", line 99, in execute
return super().execute(sql, params)
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/miniconda3/envs/ODM2DataSharingPortal/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "auth_user" does not exist
LINE 1: SELECT "auth_user"."affiliation_id" FROM "auth_user" WHERE "...
It seems that I need to fill my database instead of creating it. Is there any reference I can work with? Or may I wait for the next release?
(My supervisor wants to try this project before the new semester, Feb the 20th, and introduce it to his students, so I'm trying to make it work)
(So sad to disturb you in your free time)
I was trying to config the project myself by following the Python 2.7 section of the guide.
I've done:
odm
andodmer
odm2
database for PostgreSQL with the Database Script I did it with this:conda activate ODM2DataSharingPortal
insteadStart the initial django configuration by copying the file
./src/WebSDL/settings/settings_template.json
tosettings.json
, and fill out the values for each attribute with your server and database information. And Here comes mysetting.json
Since I want to config it step by step, so I didn't actually finish filling it.
Howerver when I run the next step's command
./src/manage.py update_controlled_vocabularies
the error occurs:It seems that I need to fill my database instead of creating it. Is there any reference I can work with? Or may I wait for the next release?
(My supervisor wants to try this project before the new semester, Feb the 20th, and introduce it to his students, so I'm trying to make it work) (So sad to disturb you in your free time)