Skip to content
Open
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
46 changes: 41 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ sudo apt install gdal-bin
```

### PostGIS
We are using Postgres/PostGIS for the database backend. For convenience, we have included a Docker compose file that you may use to run a PostGIS container. With Docker installed on your local computer, run the following command from the project root directory in order to start up PostGIS:
We are using Postgres/PostGIS for the database backend. You can use a standard docker image like https://registry.hub.docker.com/r/postgis/postgis or you can build your own image using the [Docker compose file](docker-compose.yml):

With Docker installed on your local computer, run the following command from the project root directory in order to start up PostGIS:

```
docker-compose up
Expand Down Expand Up @@ -110,13 +112,13 @@ You can override PostGIS and pgAdmin configuration prior to running `docker-comp
The next step is to run through some Jupyter Notebooks that will import
OpenStreetMap data into PostGIS. First, [download some OpenStreetMap data](http://download.geofabrik.de/) in the \*.shp.zip format. Then create a the following directory:

'''
```bash
mkdir -p notebooks/data/OSM
'''
```

and extract the downloaded archive into this location.

Refer to the README in the notebooks folder to run through the Notebooks.
Refer to the [README](notebooks/README.md) in the notebooks folder to run through the Notebooks.

## Environment
If you wish to keep the project's python environment separate from your global environment, you should create a [virtual environment](https://docs.python.org/3/library/venv.html)
Expand All @@ -129,8 +131,17 @@ source env/bin/activate
### Python dependencies
Use [pip](https://pip.pypa.io/en/stable/installing/) to install the dependencies:


* **Local development**

```
pip install -r requirements/local.txt
```

* **Production**

```
pip install -r requirements.txt
pip install -r requirements/production.txt
```

## Running the server
Expand All @@ -141,6 +152,18 @@ Move into the Project Folder:
cd platform
```

## Tunning settings

Set the file `platform/.env` You can take a look [platform/env.template](platform/env.template)
```
# Main Database:
DATABASE_URL=postgres://postgres:changeme@postgres:5432/suds

# Open Street Maps Database
DATABASE_OSM_URL=postgres://postgres:changeme@postgres:5432/openstreetmap

```

### Migrations

Before you can run the project, you will need to set up the database by running the migrations:
Expand Down Expand Up @@ -171,6 +194,8 @@ It may warn you if you use a password that is similar to your user name, or if i

You can run the server with

* **Local development**

```
python manage.py runserver
```
Expand All @@ -179,6 +204,17 @@ The server will now tell you that it's running on http://127.0.0.1:8000/

You can connect to the admin interface at http://127.0.0.1:8000/admin with your newly created superuser account.

Note that if you log in to the Django for the very first time, you will see a message that says "Verify Your E-mail Address". As django-yubin don't send any email until configure its [django command](https://django-yubin.readthedocs.io/en/latest/queue.html#command-extensions) you won't receive any verification email. You can verify the email via admin reading the email at http://127.0.0.1:8000/admin/django_yubin/message/mail/1/ and continuing the process or clicking on `Verified` checkbox at http://127.0.0.1:8000/admin/account/emailaddress/1/change/


* **Production**

```
export DJANGO_SETTINGS_MODULE=core.settings.production
python manage.py runserver
```


## Support

* See [CONTRIBUTING.md](CONTRIBUTING.md)
Expand Down
34 changes: 29 additions & 5 deletions platform/core/asgi.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,40 @@
"""
ASGI config for sustainable_urban_design_space project.
ASGI config for Sustainable Urban design project.

It exposes the ASGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
https://docs.djangoproject.com/en/dev/howto/deployment/asgi/

"""
import os
import sys
from pathlib import Path

from django.core.asgi import get_asgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings")
# This allows easy placement of apps within the interior
# main directory.
ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent
sys.path.append(str(ROOT_DIR / "main"))

# If DJANGO_SETTINGS_MODULE is unset, default to the local settings
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")

# This application object is used by any ASGI server configured to use this file.
django_application = get_asgi_application()
# Apply ASGI middleware here.
# from helloworld.asgi import HelloWorldApplication
# application = HelloWorldApplication(application)

# Import websocket application here, so apps from django_application are loaded first
from core.websocket import websocket_application # noqa isort:skip


application = get_asgi_application()
async def application(scope, receive, send):
if scope["type"] == "http":
await django_application(scope, receive, send)
elif scope["type"] == "websocket":
await websocket_application(scope, receive, send)
else:
raise NotImplementedError(f"Unknown scope type {scope['type']}")
182 changes: 0 additions & 182 deletions platform/core/settings.py

This file was deleted.

Empty file.
Loading