Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 8 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[![Stories in Ready](https://badge.waffle.io/timlinux/user_map.png?label=ready)](https://waffle.io/timlinux/user_map)
[![Build Status](http://jenkins.linfiniti.com/buildStatus/icon?job=UserMap)](http://jenkins.linfiniti.com/job/UserMap/)

User Map
========

A simple flask application for creating user community maps.

Hacking
-------

By default, this app reads configuration from `users/default_config.py`.
To override values set in default config, simply copy the contents
of `users/default_config.py` and save it elsewhere.
Expand All @@ -14,20 +14,18 @@ of `users/default_config.py` and save it elsewhere.

Then edit the custom config file, setting appropriate values as needed.

To run in debug mode (which will also serve up static content),
use the `-d` flag:
To run the development server:

USERS_CONFIG=/path/to/custom/config.py python runserver.py -d
USERS_CONFIG=/path/to/custom/config.py python manage.py runserver

Each config item is overridable through environment variable.
For instance, if you want to suppress email delivery,
simply set appropriate value:
For instance, if you want to suppress email delivery, simply set appropriate value:

USERS_MAIL_SUPPRESS_SEND=True python runserver
USERS_MAIL_SUPPRESS_SEND=True python manage.py runserver

To run testcases:

USERS_CONFIG=/path/to/custom/config.py MAIL_SUPPRESS_SEND=True ./runtests.sh
USERS_CONFIG=/path/to/custom/config.py USERS_MAIL_SUPPRESS_SEND=True ./runtests.sh

Collaboration
-------------
Expand All @@ -38,28 +36,6 @@ Collaboration
4. Once it done, submit your pull request (PR) against upstream `develop` branch.
5. Our maintainers will review your PR. If it's good — all tests passed and proposed feature is in our roadmap — your PR will be merged.

Deployment using Docker
-----------------------

If you are using docker, you can create a Docker image for this app easily as
follows:

```
wget -O Dockerfile https://raw.github.com/timlinux/user_map/master/docker/Dockerfile
wget -O sources.list https://raw.github.com/timlinux/user_map/master/docker/sources.list
wget -O post-setup.sh https://raw.github.com/timlinux/user_map/master/docker/post-setup.sh
chmod +x post-setup.sh

docker build -t linfiniti/user_map:base .
docker run -d -p 8099:80 -t linfiniti/user_map:base -n user_map -D
```

If you are on a Hetzner server, consider replacing the second line above with:

```
wget -O sources.list https://raw.github.com/timlinux/user_map/master/docker/hetzner-sources.list
```

Authors
-------

Expand Down
7 changes: 7 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from flask.ext.script import Manager

from users import APP

if __name__ == "__main__":
manager = Manager(APP)
manager.run()
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Flask==0.10.1
Flask-Mail==0.9.0
Flask-Script==2.0.5
Jinja2==2.7.3
MarkupSafe==0.23
Werkzeug==0.9.6
Expand Down
29 changes: 0 additions & 29 deletions runserver.py

This file was deleted.

19 changes: 2 additions & 17 deletions users/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,10 @@ def setup_logger():

APP = Flask(__name__)

#: Load configuration from any possible means.
#: To override default configuration defined in ``users.default_config``,
#: simply copy the contents of ``config.py`` file,
#: and save it into a file.
#:
#: .. sourcecode:: sh
#:
#: USERS_CONFIG=/path/to/config.py python runserver.py
#:
#: Another way of doing it is by setting environment variable for each
#: config item.
#:
#: .. sourcecode:: sh
#:
#: USERS_CONFIG=/path/to/config.py USERS_MAIL_SUPPRESS_SEND=True \
#: python runserver.py
#:
# Load configuration from any possible means.
AppConfig(APP, default_settings="users.default_config")

# Mailer
mail = Mail(APP)

# backward-compat
Expand Down
46 changes: 0 additions & 46 deletions users/static.py

This file was deleted.

43 changes: 18 additions & 25 deletions users/templates/html/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,24 @@
<link rel="shortcut icon" href="{{ project_favicon_file }}">
<title>{% block title %}{{ project_name | safe }} User Map{% endblock %}</title>
{% block head_resources %}
<link rel="stylesheet" href="/users/static/css/bootstrap.css"
type="text/css" static="screen, projection"/>
<link rel="stylesheet" href="/users/static/css/leaflet.css"/>
<!--[if lte IE 8]>
<link rel="stylesheet" href="/users/static/css/leaflet.ie.css" />
<![endif]-->
<link rel="stylesheet" href="/users/static/css/leaflet.label.css"/>
<link rel="stylesheet" href="/users/static/css/user-map.css"
type="text/css"/>
<script language="javascript"
type="text/javascript" src="/users/static/js/jquery.js"></script>
<script language="javascript"
type="text/javascript" src="/users/static/js/bootstrap.min.js"></script>
<script src="/users/static/js/leaflet.js"></script>
<script src="/users/static/js/leaflet.label.js"></script>
<script language="javascript"
type="text/javascript" src="/users/static/js/user-map.js"></script>
<script language="javascript"
type="text/javascript" src="/users/static/js/user-map-component.js"></script>
<script language="javascript"
type="text/javascript" src="/users/static/js/user-map-state.js"></script>
<script language="javascript"
type="text/javascript" src="/users/static/js/user-map-utilities.js"></script>
<script language="javascript"
type="text/javascript" src="/users/static/js/validate.js"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.css') }}" type="text/css" static="screen, projection"/>
<link rel="stylesheet" href="{{ url_for('static', filename='css/leaflet.css') }}"/>
<!--[if lte IE 8]>
<link rel="stylesheet" href="{{ url_for('static', filename='css/leaflet.ie.css') }}"/>
<![endif]-->
<link rel="stylesheet" href="{{ url_for('static', filename='css/leaflet.label.css') }}"/>
<link rel="stylesheet" href="{{ url_for('static', filename='css/user-map.css') }}" />

<script language="javascript" type="text/javascript" src="{{ url_for('static', filename='js/jquery.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ url_for('static', filename='js/leaflet.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ url_for('static', filename='js/leaflet.label.js') }}"></script>

<script language="javascript" type="text/javascript" src="{{ url_for('static', filename='js/user-map.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ url_for('static', filename='js/user-map-component.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ url_for('static', filename='js/user-map-state.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ url_for('static', filename='js/user-map-utilities.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ url_for('static', filename='js/validate.js') }}"></script>
{% endblock head_resources %}
</head>
<body>
Expand Down
12 changes: 7 additions & 5 deletions users/templates/html/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{% extends "html/base.html" %}

{% block head_resources %}
{{ super() }}
<link rel="stylesheet" href="/users/static/css/MarkerCluster.css"/>
<link rel="stylesheet" href="/users/static/css/MarkerCluster.user-map.css"/>
<!--[if lte IE 8]><link rel="stylesheet" href="/users/static/css//MarkerCluster.user-map.ie.css" /><![endif]-->
<script src="/users/static/js/leaflet.markercluster-src.js"></script>
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='css/MarkerCluster.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/MarkerCluster.user-map.css') }}" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="{{ url_for('static', filename='css/MarkerCluster.user-map.ie.css') }}" />
<![endif]-->
<script src="{{ url_for('static', filename='js/leaflet.markercluster-src.js') }}"></script>
{% endblock head_resources %}

{% block body %}
Expand Down
6 changes: 3 additions & 3 deletions users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def add_user_view():
body = render_template(
'text/registration_confirmation_email.txt',
project_name=APP.config['PROJECT_NAME'],
url=APP.config['PUBLIC_URL'],
url=APP.config["PUBLIC_URL"],
user=added_user)
recipient = added_user['email']
send_async_mail(
Expand Down Expand Up @@ -307,7 +307,7 @@ def delete_user_view(guid):
"""
# Delete User
delete_user(guid)
return APP.config['PUBLIC_URL']
return APP.config["PUBLIC_URL"]


@APP.route('/download')
Expand Down Expand Up @@ -362,7 +362,7 @@ def reminder_view():
body = render_template(
'text/registration_confirmation_email.txt',
project_name=APP.config['PROJECT_NAME'],
url=APP.config['PUBLIC_URL'],
url=APP.config["PUBLIC_URL"],
user=user)
send_async_mail(
sender=MAIL_ADMIN,
Expand Down