-
Notifications
You must be signed in to change notification settings - Fork 2
Setup Project on MacOS
The goal of this article is to provide step-by-step instructions on how to setup workery-django on your MacOS
local machine.
You must have the following applications installed before proceeding. If you are missing any one of these then you cannot begin.
Python 3.6
brew
virtualenv
redis
PostGres
The following section explains how to setup the application.
- Clone a copy of the project somewhere on your machine, we'll be saving to the following locaiton.
mkdir ~/Developer/workery/;
cd ~/Developer/workery/
git clone https://github.com/workery/workery-django;
cd ~/Developer/over55/workery-django
- Setup our virtual environment
virtualenv -p python3.6 env
- Now lets activate virtual environment
source env/bin/activate
- Now lets install the libraries this project depends on.
pip install -r requirements.txt
This project uses the PostGres
database and as a result requires setup before running. The following instructions are to be run in your PostGres
console:
drop database workery_db;
create database workery_db;
\c workery_db;
CREATE USER django WITH PASSWORD '123password';
GRANT ALL PRIVILEGES ON DATABASE workery_db to django;
ALTER USER django CREATEDB;
ALTER ROLE django SUPERUSER;
CREATE EXTENSION postgis;
- Populate the environment variables for our project.
./setup_credentials.sh
- Go inside the environment variables.
vi ./workery/workery/.env
- Edit the file to suite your needs.
Run the following commands to populate the database.
cd ../workery/workery-django/workery;
python manage.py makemigrations; \
python manage.py migrate_schemas; \
python manage.py init_app; \
python manage.py populate_site; \
python manage.py populate_public; \
python manage.py create_shared_account "bart@email.com" "123password" "Bart" "Mika" "123 123-1234" "" "123 123-1234" "CA" "London" "Ontario" "" "N6H 1B4" "78 Riverside Drive" ""; \
python manage.py create_franchise "london" "Over55" "Over55 (London) Inc." "Located at the Forks of the Thames in downtown London Ontario, Over 55 is a non profit charitable organization that applies business strategies to achieve philanthropic goals. The net profits realized from the services we provide will help fund our client and community programs. When you use our services and recommended products, you are helping to improve the quality of life of older adults and the elderly in our community." "CA" "London" "Ontario" "" "N6H 1B4" "78 Riverside Drive" "";
This project is uses django-tenants
library and is setup to work with multiple domains. As a result, we will need to bind the address workery.ca to your localhost
. To do this follow these instructions.
- Update your hosts file to support our applications domain.
sudo vi /etc/hosts
- Append to the file...
127.0.0.1 workery.ca
127.0.0.1 workery.ca
127.0.0.1 london.workery.ca
127.0.0.1 london.workery.ca
- Refresh the dns on your machine to support our new domains.
dscacheutil -flushcache
To run the web-app, you’ll need to run the server instance and access the page from your browser.
Start up the web-server:
sudo python manage.py runserver workery.ca:80
And inside another seperate Terminal
console, please run:
python manage.py rqworker
Finally, in your web-browser, load up the following url:
http://workery.ca/
Congratulations, you are all setup to run the web-app! Have fun coding!#