This is the base project for wechange. It is mainly a configurable shell for the actual wechange apps, which are pluggable components. Most of the actual code resides in "cosinnus-core". See requirements_staging.txt
for a full list of internal apps.
Note: The wechange project is often refered to as "neww" in code and imports and the internal apps and python Objects are named "cosinnus" for historical reasons.
git submodule init
git submodule update
docker-compose up
This will set up a local development environment, getting you ready to work on wechange and all its internal apps.
brew install gdal
pip install --upgrade pip
- Upgrade pip. Don't skip this step!pip install virtualenv
- Install virtualenvvirtualenv <your-path>/wechangeenv
- Create your virtualenv oncesource <your-path>/wechangeenv/bin/activate
- Activate your wechange virtualenv (do this in every new console when working on wechange)mkdir <your-project-folder>/wechange-source
- Create the new wechange project locationcd <your-project-folder>/wechange-source
git clone git@github.com:wechange-eg/cosinnus-devops.git cosinnus-devops
cd cosinnus-devops/devops
- Get into the devops folder and initiate subfoldersgit submodule init
git submodule update
./cosinnus-devops/local_setup.sh
setup.log
log output and make sure that each individual call resulted in a successfull install, and did not stop with an error. If there are any errors in any of the calls, you need to resolve them and run local_setup.sh
again untill all of them complete successfully!install_requires=[...]
array in the setup.py
file of the offending cosinnus subdirectory to complete the script. This is okay since all requirements will be properly installed through the requirements file in the next step.pip install -r ./cosinnus-devops/requirements_local.txt
Notes:
cd cosinnus-devops
cp devops/settings_local.py devops/settings.py
devops/settings.py
:
DATABASES['default']
: ./manage.py migrate
- Creates all the empty database tables./manage.py createsuperuser
- Creates your own user account
./manage.py runserver
- Runs the serverhttp://localhost:8000/admin
and log in with the email address and password you just created
http://localhost:8000/admin/sites/site/1/
and change the default Site to ./manage.py runserver
This will compile the client.js
JS client, which is used for the Map/Tile View and the v2 User Dashboard and Navbar. After setting up your environment, you need to do this at least once.
cosinnus-core
source directorynpm install
npm run dev
. You can leave this running to automatically recompile the client on any changes, or just quit the watcher process after compilation is complete.If you are not planning to work with the map or “search” you can skip this step, otherwise it is required.
cosinnus-devops/elasticsearch-1.3.9-docker/
run docker-compose up -d
brew tap elastic/tap
brew install elastic/tap/elasticsearch-full
"""
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
},
}
"""
# enable this haystack setting if you have actually set up elastic search on your system
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'cosinnus.backends.RobustElasticSearchEngine', # replaces 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'wechange',
},
}
This is an optional step for your your local environment. If you choose not to do this, your root URL will stay blank, but all other URLs will work fine.
We use Wagtail as CMS, and it will show up automatically as a root URL dashboard. You can skip this step configuring it, but all you will see on your root URL will be a blank page. Navigate to a page like http://localhost:8000/projects/
to see the wechange-page.
http://localhost:8000/cms-admin/pages/
http://localhost:8000/
, you should see the blank CMS dashboard.
http://localhost:8000/groups/
To use MariaDB instead of Postgres locally, you will need to modify the following migrations files
In both, replace
django.contrib.postgres.fields.jsonb.JSONField
with
django_mysql.models.JSONField
Cosinnus-devops pulls Cosinnus-core and all cosinnus apps in directly from their Git repositories. See requirements_staging.txt
for the repo locations and used branches.
WECHANGE supports sub-portals that share the same database and can display the contents of other portals in the same "pool" in searches and map views. For this, create a new CosinnusPortal in the django admin, enter its portal name, site-id and settings in config_subportal.py.
Run the new portal using ./manage.py --cosinnus-portal <portalname>
.
For multiple subportals, duplicate the wsgi_subportal.py
and config_subportal.py
.
wechange uses the Browserstack Testing Suite for Browser Testing.