- Setup a new virtualenv:
virtualenv .venv
- Install requirements:
pip install -r requirements.txt
- Run tests to check setup:
python manage.py test
- Configure your environment.
- Setup static files
Before running the Django server locally, you should set some environment- specific values, as defined below:
BASE_URL
- Main URL where the app will be available (NO TRAILING SLASH!)BLOG_URL
- Blog URL.CONTACT_EMAIL
- Contact e-mail to be presented on footer.CONTACT_PHONE
- Contact phone to be presented on footer.DATABASE_URL
- Database connection URL (eg.postgres://user:pass@server:port/db
)DEBUG
- Set debug mode ('true'
or'false'
)DEFAULT_FROM_EMAIL
- Email address to identify outcoming transactional emailsEMAIL_HOST_PASSWORD
- Password to authenticate on the SMTP serverEMAIL_HOST_USER
- Username to authenticate on the SMTP serverEMAIL_HOST
- SMTP host name to be used for email sendingEMAIL_PORT
- SMTP port to be used for email sendingFACEBOOK_API_KEY
- Facebook app key (used for registration)FACEBOOK_API_SECRET
- Facebook app secret (used for registration)GOOGLE_API_KEY
- Google services API keyGOOGLE_ANALYTICS_ID
- Google Analytics tracking IDMAILING_ADDRESS
- Physical address of the organization running the projectSECRET_KEY
- Unique and secret salt for passwords, hashes and session keysSENTRY_DSN
- Optional. Use this to configure your Sentry DSN.SNS_FACEBOOK
- URL of the Facebook fan pageSNS_GOOGLEPLUS
- URL of the Google+ pageSNS_TWITTER
- URL of the Twitter profile
Brasil.com.vc is a GeoDjango application. We use PostGIS as our database, so you'll need to install some geospatial libraries, for that refer to the GeoDjango manual or follow the steps below.
Setup your PostGIS database:
-
Install your PostgreSQL environment. Although you can easily setup a PostGIS-enabled PostgreSQL database through your OS' package manager, we recommend using Docker for this:
docker run -d -p 5432:5432 --name bcv_db jamesbrink/postgresql
-
Create the database:
docker exec bcv_db psql -U postgres -c "create database bcv;"
-
Turn on PostGIS extensions:
docker exec bcv_db psql -U postgres -c "create extension postgis;" bcv docker exec bcv_db psql -U postgres -c "create extension postgis_topology;" bcv
-
Export the
DATABASE_URL
environmentexport DATABASE_URL="postgis://postgres:@$(docker port bcv_db 5432)/bcv"
- Set up SpatiaLite on your system.
- Set a new env var
SPATIALITE_LIBRARY_PATH
with your OS' library path.
Note the following:
- You should create the database using the SpatiaLite bin before running migrations.
- The built-in
DATABASE_URL
value expects a SpatiaLite database by default.
You must set up Node.js in order to make static files gathering and processing work.
- Install Node + npm. For OS X using Homebrew:
brew install npm
- Install required packages:
npm install
npm
will call bower after install
S3 is also supported as static server. To enable S3 support the following environment variables must be configured:
STATIC_BACKEND
- Set this tos3
to enable S3 supportAWS_ACCESS_KEY_ID
- Your AWS access key IDAWS_SECRET_ACCESS_KEY
- Your AWS secret access keyAWS_STORAGE_BUCKET_NAME
- Your bucket nameAWS_S3_CUSTOM_DOMAIN
- Optional. A custom domain to be used