- Developer workflows (for pull requests and creating branches)
- ADA Documentation and code
If you haven't run Vagrant yet, see the 'Setting up for Development' section below.
- Start the dev environment from the root of the project directory:
vagrant up
- ssh to the guest machine:
vagrant ssh
- The following commands run automatically after
vagrant ssh
to activate the virtualenv and move to the working directory:source lw/bin/activate && cd /vagrant/
- Start the Django dev server:
./manage.py runserver 0.0.0.0:8000
Since the majority of development tasks don't require Elasticsearch or NodeJS it is often faster and more desireable to build the site without these things. This can be accomplished by running vagrant up
with the ELASTICSEARCH
or NODEJS
environment variables set to false
:
ELASTICSEARCH=false NODEJS=false vagrant up
Note: If you build the site withouth Elasticsearch, you will need the following in your local.py
:
WAGTAILSEARCH_BACKENDS = {
'default': {
'BACKEND': 'wagtail.search.backends.database',
}
}
If you have issues loading your local instance, try:
vagrant halt
vagrant destroy
vagrant up
pip install -r requirements.txt
Loop Sass file compression is separate from the public site compression. If you want to compress new Sass code into an updated CSS file, in a terminal that is not running Vagrant, run 'gulp' in the root directory. This command should start a watch on all Loop Sass files and compress anytime a Sass file is saved.
- Install VirtualBox and Vagrant
- Clone this repo or fetch the newest code
- Create a local config file (see example below)
- Create the dev environment from the root of the project directory:
vagrant up
(this will take awhile) - ssh to the guest machine:
vagrant ssh
- Activate the virualenv and navigate to the root directory:
source lw/bin/activate && cd /vagrant/
- Start the Django dev server:
./manage.py runserver 0.0.0.0:8000
- In the Wagtail admin go to:
Settings > Sites
and delete ths site calledlocalhost
. - If you're not a regular contributor to the Library website, you will need to create a superuser by running
./manage.py createsuperuser
. This will allow you access to the admin. If you're a Library developer, however, this was already done for you.
Create the file library_website/settings/local.py
. It should look something like this:
import sys
if 'test' in sys.argv:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
'TEST': {
'NAME': ':memory:',
},
},
}
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'lib_www_dev',
}
}
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'formatter': 'default',
'filename': '/var/log/django-errors.log',
},
},
'loggers': {
'django.request': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
},
'formatters': {
'default': {
'format': '[%(asctime)s] (%(process)d/%(thread)d) %(name)s %(levelname)s: %(message)s'
}
}
}
# ** You will also need to add settings for the following. Get these from another developer. **
DIRECTORY_USERNAME = #Get from another developer
DIRECTORY_WEB_SERVICE = #Get from another developer
DIRECTORY_PASSWORD = #Get from another developer
OWNCLOUD_PASSWORD = #Get from another developer
Add the following lines to your /etc/hosts
file
127.0.0.1 wwwdev
127.0.0.1 loopdev
This will allow you to access the public site at http://wwwdev:8000
and the intranet at http://loopdev:8000
.
These are the images used on pages in the test database on the dev version of the site. Not having these is fine, however, you will have broken image links if you don't get them.
All you need to do is download the images from box, put them in /media/original_images/
,
and run ./manage.py wagtail_update_image_renditions
.
- ssh to motacilla
cd /data/local/ ; source venv3.9/bin/activate ; cd sites/library_website
git remote update
git status
git pull origin master
./manage.py migrate
only needed if made migrations./manage.py compress
./manage.py collectstatic
sudo service apache24 restart
If your changes aren't loading into production, try:
- Compress, collectstatic, and restart apache again
- Clear the Wagtail cache in Wagtail settings
- Clear the Django cache manually
./manage.py shell
from django.core.cache import cache
cache.clear()
For testing purposes, you may want to push a branch that is not master to Nest.
- ssh to nest
cd /data/local/ ; source venv3.9/bin/activate ; cd sites/library_website
git remote update
git status
git checkout {{ branch-name }}
git pull origin {{ branch-name }}
./manage.py migrate
only needed if made migrations./manage.py compress
./manage.py collectstatic
sudo service apache24 restart