The software required is listed below, along with commands for installation on OSX.
- Python 3
brew install python3
- Virtualenv
pip install virtualenv
- Postgres
brew install postgresql
- MySQL
brew install mysql
- Clone this repo and
cdinto the project.
git clone https://github.com/DALME/dalme.git
- Set up a virtualenv for development. In this case, we're calling the environment "dalme" and placing it in a directory called
virtualenvsin the home directory, but you can call it whatever you want and put it wherever you want.
virtualenv -p python3 ~/virtualenvs/dalme
- Activate the virtual environment.
source ~/virtualenvs/dalme/bin/activate
-
Install the dependencies.
- (in the directory for this repository)
pip install -r requirements.txt - Some installations may fail, try installing command line tools:
xcode-select --install
- Also try installing
psycopgand/ormysqlclientwith the following pip commands:env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip --no-cache install psycopg2env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip --no-cache install mysqlclient
- Alternatively, for compilers to find openssl you can set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"export CPPFLAGS="-I/usr/local/opt/openssl/include"
- (in the directory for this repository)
-
Get a copy of the
envanddb.cnffiles from someone else in the project and place it in the root of the repository's directory. -
Prime your filesystem for logging.
sudo mkdir /var/log/django && \
sudo touch /var/log/django/dalme_app.log && \
sudo chown -R $(whoami) /var/log/django
- Source the environment settings.
source ./env
- Restore the db dump and create the application db user.
$ mysql -u root < path_to_db_dump.sql
$ mysql -u root
-- Where `$PASSWORD` == `password` found in the `db.cnf` file.
mysql> CREATE USER 'dalme_app'@'localhost' IDENTIFIED BY '$PASSWORD';
mysql> GRANT ALL PRIVILEGES ON dalme_db.* TO 'dalme_app'@'localhost';
mysql> FLUSH PRIVILEGES;
-- While we are in the mysql shell let's set your `User` record (which should
-- already be in the database dump) as a local superuser.
-- First find the pk of your row and then update it.
mysql> USE dalme_db;
mysql> SELECT username, id FROM auth_user;
mysql> UPDATE auth_user SET is_superuser = 1 WHERE id = $YOUR_USER_PK;
Change your local password if you need to.
$ python manage.py changepassword $YOUR_USERNAME
If you don't already have a record in the database, create one.
python manage.py createsuperuser
- Build the CMS tree.
python manage.py create_site
- Test the local development setup.
python manage.py runserver
If you create a new terminal to do this, you'll need to make sure that you're in your environment with source ~/virtualenvs/dalme/bin/activate.
-
Check out the site at
localhost:8000andlocalhost:8000/cms. -
You can monitor the log output if you feel like it. Open a separate terminal and call:
$ tail -f /var/log/django/dalme_app.log