-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from volunteer-planner/release/1.4.3
Release 1.4.3
- Loading branch information
Showing
56 changed files
with
1,053 additions
and
377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ fabfile.py | |
manlocal.py | ||
db.sqlite3 | ||
.DS_Store | ||
*.mo | ||
*.mo | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
language: python | ||
python: "2.7" | ||
before_install: | ||
- sudo apt-get update && sudo apt-get --reinstall install -qq language-pack-en language-pack-de | ||
install: "pip install -r requirements/dev.txt" | ||
env: DJANGO_SETTINGS_MODULE=volunteer_planner.settings.local | ||
script: py.test --create-db tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,198 @@ | ||
# volunteer_planner | ||
This repro hosts the code for volunteer-planner.org. A platform to schedule shifts of volunteers. | ||
|
||
## Please do pull request against the development branch. | ||
If you have questions concerning our workflow please look here | ||
https://github.com/volunteer-planner/volunteer_planner/wiki/DevelopmentRules | ||
A platform to schedule shifts of volunteers. | ||
|
||
## Setup (Ubuntu 14.04) | ||
## Project Setup | ||
|
||
### 1.Install all required Ubuntu packages | ||
### 0. Prerequisites (Ubuntu 14.04 example) | ||
|
||
If your machine is setup to work on Django projects, you might skip this step. | ||
|
||
#### 0.1 Installing required OS packages | ||
|
||
sudo apt-get install python-dev python-pip git npm | ||
|
||
This will install Python libraries and Git. | ||
|
||
If you are going to use a local mysql server, additionally install | ||
#### 0.2 Using MySQL locally (optional) | ||
|
||
Using MySQL locally for development is optional. | ||
|
||
#### 0.2.1 Installing MySQL (optional) | ||
|
||
If you are going to use a local MySQL server, additionally install | ||
|
||
sudo apt-get install libmysqlclient-dev mysql-client mysql-server | ||
|
||
This will install MySQL server, it will ask you to set a root password | ||
[ROOT_PASSWORD] for the mysql server, if you haven't already set up MySQL in the | ||
This will install MySQL server, it will ask you to set a root password | ||
[ROOT_PASSWORD] for the MySQL server, if you haven't already set up MySQL in the | ||
past. Remember the password. | ||
|
||
### 2. Clone the repository | ||
#### 0.2.2 Creating a local MySQL database and user (optional) | ||
|
||
git clone https://github.com/volunteer-planner/volunteer_planner.git | ||
|
||
An instance of the volunteer_planner will be created in the folder | ||
`volunteer_planner`. | ||
Open the MySQL shell | ||
|
||
mysql -u root -p | ||
|
||
### 3. Create a virtual environment | ||
and execute following queries to setup the DB | ||
|
||
virtualenv --no-site-packages volunteer_planner-venv | ||
|
||
Enable the virtual environment by running | ||
CREATE DATABASE volunteer_planner; | ||
GRANT ALL PRIVILEGES ON volunteer_planner.* to vp identified by 'volunteer_planner'; | ||
|
||
bash | ||
|
||
source volunteer_planner-venv/bin/activate (for bash) or | ||
*Note*: For the local environment, the DB username is assumed to be 'vp' | ||
and their password is assumed to be 'volunteer_planner'. | ||
|
||
fish | ||
### 1. Fork us on GitHub | ||
|
||
. volunteer_planner-venv/bin/activate.fish | ||
Please fork us on GitHub and clone your fork | ||
|
||
### 4. Install all requirements by running | ||
git clone https://github.com/YOUR_GITHUB_ACCOUNT/volunteer_planner.git | ||
|
||
cd volunteer_planner | ||
|
||
For a local sqlite DB install | ||
### 1.1 Creating Pull Requests | ||
|
||
pip install -r requirements/dev.txt | ||
Please do Pull Requests against the [`develop` branch](https://github.com/volunteer-planner/volunteer_planner/tree/develop). | ||
|
||
or, if you intend to use mysql locally, install | ||
If you have questions concerning our workflow please read the | ||
[Development Rules wiki page](https://github.com/volunteer-planner/volunteer_planner/wiki/DevelopmentRules). | ||
|
||
pip install -r requirements/dev_mysql.txt | ||
### 2. Setup your virtual environment | ||
|
||
### 5. Create a local mysql database and user | ||
#### 2.1. Create a virtual env | ||
|
||
Create an virtualenv (using [virtualenvwrapper](https://virtualenvwrapper.readthedocs.org/)): | ||
|
||
mysql -u root -p | ||
$ mkvirtualenv vp | ||
|
||
CREATE DATABASE volunteer_planner; | ||
GRANT ALL PRIVILEGES ON volunteer_planner.* to vp identified by 'volunteer_planner'; | ||
\q | ||
*Note*: using `vp` as your virtualenv's name is a recommendation, not a requirement. | ||
|
||
*Note*: For the local environment, the DB username is assumed to be 'vp' | ||
and their password is assumed to be 'volunteer_planner'. | ||
The virtual environment should be enabled afterwards. | ||
For starting/continuing working on the project using the virtualenv, | ||
activate the virtual env using | ||
|
||
$ workon vp | ||
|
||
#### 2.2 Installing required python packages | ||
|
||
Update pip | ||
|
||
pip install -U pip | ||
|
||
For a local sqlite DB install | ||
|
||
pip install -r /path/to/volunteer_planner.git/requirements/dev.txt | ||
|
||
or, if you intend to use MySQL locally, install | ||
|
||
pip install -r /path/to/volunteer_planner.git/requirements/dev_mysql.txt | ||
|
||
*Note*: `/path/to/volunteer_planner.git` means the path of your local clone of the | ||
GitHub project. Replace it accordingly with the actual path. | ||
|
||
### 6. Setup your local environment (optional) | ||
#### 2.3 Setup your virtualenv `postactivate` hook (optional) | ||
|
||
If you need to use non-default settings values, setup the environment variables | ||
in your virtualenv's (post-)activation hooks or your IDE's project settings. | ||
This step is optional but recommended. | ||
|
||
### 7. Initialize the database | ||
Every time, a virtualenv is activated with virtualenvwrappers' `workon` command, | ||
a `postactivate` script is executed. This comes in handy to autmatically setup | ||
a projects' environment variables and automate some reoccuring tasks. | ||
For more details on virtualenvwrapper hooks, see [virtualenvwrapper: Per-User Customization](http://virtualenvwrapper.readthedocs.org/en/latest/scripts.html). | ||
|
||
./manlocal.py migrate | ||
You might consider to use this example `postactivate` script | ||
(located at `$VIRTUAL_ENV/bin/postactivate`) | ||
|
||
### 8. Add a superuser | ||
#!/bin/bash | ||
# This hook is run after this virtualenv is activated. | ||
| ||
export DJANGO_SETTINGS_MODULE="volunteer_planner.settings.local" | ||
cd /path/to/volunteer_planner.git/ | ||
| ||
git fetch --all | ||
git status | ||
|
||
./manlocal.py createsuperuser | ||
#### 2.3.1 Setup your local environment (optional) | ||
|
||
Also, if you need to use non-default settings values, setting (exporting) the | ||
environment variables in your virtualenvs' `postactivate` hook is a good place | ||
if you're not using an IDE to configure your environment variables. | ||
|
||
|
||
### 3. Initialize the database with Django | ||
|
||
Activate your env and change dir to your local forks' git repository (if not done yet). | ||
|
||
workon vp | ||
cd /path/to/volunteer_planner.git | ||
|
||
#### 3.1 Run migrate management command to setup non-existing tables | ||
|
||
./manage.py migrate | ||
|
||
### 3.2 Add a superuser | ||
|
||
You will be asked for username, email and password (twice). Remember that | ||
./manage.py createsuperuser | ||
|
||
You will be asked for username, email and password (twice). Remember that | ||
username and password. | ||
|
||
### 9. Try running the server | ||
### 4. Try running the server | ||
|
||
./manlocal.py runserver | ||
./manage.py runserver | ||
|
||
Try opening http://localhost:8000/ in your browser. | ||
|
||
### 9. Adding content | ||
### 5. Adding content | ||
|
||
To add new organizations and shifts, you have to access the backend at | ||
`http://localhost:8000/admin`. If prompted, login with the username/password of | ||
To add new organizations and shifts, you have to access the backend at | ||
`http://localhost:8000/admin`. If prompted, login with the username/password of | ||
the superuser you created earlier (in case you don't see an error page here). | ||
|
||
http://localhost:8000/admin` | ||
http://localhost:8000/admin | ||
|
||
## The Project | ||
|
||
We use less for precompiling css. The less file you will find in | ||
`scheduler/static/bootstrap/less/project.less` To make this work you can just | ||
initialize the folder with "npm install -g" and then let grunt watch for | ||
### Create Dummy Data | ||
|
||
run management command " python manage.py create_dummy_data 5 --flush True " with activated virtualenv to get 5 days of dummy data and delete tables in advance. | ||
|
||
The number (5 in the above example) creates 5 days dummy data count from today. | ||
If you just use "python manage.py create_dummy_data 5" without --flush it is NOT deleting data before putting new data in. | ||
|
||
### Running Tests | ||
|
||
*Note*: we're committed to testing and hope, the next paragraph will not be a lie any longer soon :-) | ||
|
||
We are using test driven development (TDD) with [py.test](http://pytest.org/). | ||
|
||
A good read on TDD is the free o'Reilly eBook ["Test-Driven Development with Python"](http://chimera.labs.oreilly.com/books/1234000000754/index.html) | ||
|
||
To run the tests, run the following command (with your virtual env activated, see 3.) | ||
|
||
$ py.test [/path/to/volunteer_planner.git/] | ||
|
||
### Translations | ||
|
||
Can create/update the translations file with | ||
|
||
``` | ||
./manage.py makemessages --no-obsolete --no-wrap | ||
``` | ||
|
||
The options are intended to make the output more git-friendly. | ||
|
||
Compile the messages file with | ||
|
||
``` | ||
./manage.py compilemessages | ||
``` | ||
|
||
Your local installation should be translated then. | ||
The .mo file created by compilemessages is gitignored, | ||
you'll need to (re-)generate it locally every time the .po file changes. | ||
|
||
|
||
### CSS / Less | ||
|
||
We use less for precompiling css. The less file you will find in | ||
`scheduler/static/bootstrap/less/project.less` To make this work you can just | ||
initialize the folder with "npm install -g" and then let grunt watch for | ||
changes. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{% extends 'home.html' %} | ||
{% load i18n %} | ||
|
||
{% block title %}{{ user.username }}{% endblock %} | ||
{% block body_class %}helpdesk{% endblock %} | ||
|
||
{% block navbar %} | ||
{% include 'navbar.html' %} | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div class="col-md-8 col-md-offset-2 update_form"> | ||
<form action="." method="POST"> | ||
{% csrf_token %} | ||
{{ form.as_p }} | ||
<input class="button" type="submit" value="{% trans 'Save' %}"> | ||
</form> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{% extends 'home.html' %} | ||
{% load i18n %} | ||
|
||
{% block title %}{{ user.username }}{% endblock %} | ||
{% block body_class %}helpdesk{% endblock %} | ||
|
||
{% block navbar %} | ||
{% include 'navbar.html' %} | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div class="col-md-8 col-md-offset-2"> | ||
<ul class="list-group"> | ||
<li class="list-group-item list-group-item-info">{% trans 'Username' %}: {{ user.username }}</li> | ||
<li class="list-group-item list-group-item-info">{% trans 'First name' %}: {{ user.first_name }}</li> | ||
<li class="list-group-item list-group-item-info">{% trans 'Last name' %}: {{ user.last_name }}</li> | ||
<li class="list-group-item list-group-item-info">{% trans 'Email' %}: {{ user.email }}</li> | ||
</ul> | ||
<div> | ||
<a href="{% url 'account_edit' %}" class="btn btn-default">{% trans 'Edit Account' %}</a> | ||
</div> | ||
</div> | ||
{% endblock %} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.