This repository was archived by the owner on Apr 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Installation on Linux
Brian Pepple edited this page Jun 4, 2018
·
21 revisions
This has been tested on Fedora 27, but for other distribution it's not really much different other than using your distributions package management system instead of dnf when installing postgresql and redis. Note: While this is still in the early stages of development, these instructions will be for using it with Django's built-in server instead of a proper production installation.
Note: If you want to set-up a production instance of Bamf, you can use these instructions. The only thing you would need to do different is git clone bamf instead of creating a new django project, and systemd'ing your huey instance.
- Run the following commands in Terminal:
- Install redis and postgresql:
sudo dnf install postgresql-server postgresql-contrib redis - Initialize postgresql:
sudo postgresql-setup --initdb --unit postgresqlNote: If you're using Ubuntu, you can skip this step. - Start postgresql:
sudo systemctl start postgresql - Change to the postgres user:
sudo su - postgres - Log into a Postgres session by typing:
psql - Create a database for our Django project (substitute something more descriptive than 'myproject'):
CREATE DATABASE myproject; - Create a database user which we will use to connect to and interact with the database:
CREATE USER myprojectuser WITH PASSWORD 'password'; - We are setting the default encoding to UTF-8, which Django expects. We are also setting the default transaction isolation scheme to "read committed", which blocks reads from uncommitted transactions. Lastly, we are setting the timezone. By default, our Django projects will be set to use UTC:
ALTER ROLE myprojectuser SET client_encoding TO 'utf8';ALTER ROLE myprojectuser SET default_transaction_isolation TO 'read committed';ALTER ROLE myprojectuser SET timezone TO 'UTC';
- Give our database user access rights to the database we created:
GRANT ALL PRIVILEGES ON DATABASE myproject TO myprojectuser; - Exit the SQL prompt to get back to the postgres user's shell session:
\q - Exit out of the postgres user's shell session to get back to your regular user's shell session:
exit
- Install redis and postgresql:
- Run the following commands in Terminal:
- Install Virtual Environment:
pip install virtualenv - Change to the directory you want install Bamf. For example, if you want to install this in your Documents folder:
cd ~/Documents/ - Create your virtual environment:
virtualenv -p python3 virt - Activate virtual environment:
source virt/bin/activate
- Install Virtual Environment:
- Download the repository, unarchive it, and rename it to
bamf. - Copy
bamfto thevirtdirectory. - Run the following commands in Terminal:
- Change into the bamf directory:
cd ~/Documents/virt/bamf - Install dependencies:
pip install -r requirements.txt - Edit bamf/settings.py, and find the
DATABASESsection and edit the values for theNAME,USER,PASSWORD, with the information from when you set-up the postgresql database in Section 1. - Generate a secret key (for Django security):
python manage.py generatesecretkey - Create your database:
python manage.py migrate - Create your admin user:
python manage.py createsuperuser - Open a second terminal window and run the following commands:
- Change into the
virtdirectory:cd ~/Documents/virt - Activate virtual environment:
source virt/bin/activate - Change into the
bamfdirectory:cd ~/Documents/virt/bamf - Start the redis server:
sudo systemctl start redis - Start up huey for task management:
python manage.py run_huey - Keep redis & huey running!
- Change into the bamf directory:
- Start your local server:
python manage.py runserver- For example:
python manage.py runserver
- For example:
- In your browser, go to
http://[YOUR IP ADDRESS]:8000- For example:
http://192.168.1.30:8000
- For example: