LNLDB now runs under Python3.x and Django 2.2 or later.
You are going to need some basic Python/Git tools to run the code. The most important are Python3 and virtualenv (which allows you to install python libs without root). The rest are to compile the python binary libraries, namely MySQL and image manipulation.
sudo apt-get install python3 python3-dev python-pip python-virtualenv git libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev libmysqlclient-dev
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
pip install virtualenv
It is certainly possible to run via Windows practically without changes, but figuring out that setup is left as an excercise for the user (hint: use pycharm).
If you're reading this outside of Github, you can skip this.
git clone https://github.com/WPI-LNL/lnldb.git
cd lnldb
This uses a lot of library functionalities in the form of plugins. We will make a virtualenv to keep all of this away
from the system Python installation (ie. don't need root), and install our packages directly to the env
folder.
virtualenv env
source env/bin/activate
pip install -r requirements_debug.txt
The first line makes/loads the actual database schema, by walking through all of the previous schemas and making necessary changes to the database one-by-one so that no data is ever lost regardless of versions. On your machine, the database will by default be an Sqlite file in the runtime folder, on the server, it's WPI's hosted MySQL server.
The second line will populate any data with a useful initial value. Examples include groups, permissions, locations, etc.
If you have updated these or have existing data, don't run this. You can also use this method to load a backup from the
production database (dbbak
on server).
The third will create an account to let you log in once you've started the server.
python manage.py migrate
python manage.py loaddata fixtures/*.json
python manage.py createsuperuser
This app includes a number of self-checks to sanity test new code. All new patches are expected to have tests included, and will be checked automatically when pushed to Github. Also try using the '-n' flag to speed it up.
python manage.py test
python manage.py runserver
or python manage.py shell_plus
Note that in future sessions, you must first call source env/bin/activate
to set up the local path
lnldb/local_settings.py
, where those and any platform-specific options can be included.You can now deploy a test server using one button! Well.... almost. You still need to figure out s3, and make a login.
heroku run python manage.py createsuperuser
Minimal IAM Policy
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:PutObjectAcl",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::yourbucket",
"arn:aws:s3:::yourbucket/*"
]
}
]
}