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
31 changes: 31 additions & 0 deletions DEPLOY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
docker network create my-net

docker run --net my-net -e POSTGRES_HOST_AUTH_METHOD=trust --name postgres2 -p5432:5432 -d postgres

Enable PostGis

docker exec -it postgres2 bash

apt-get update

apt-get install postgresql-14-postgis-3

# Dockerfile
https://github.com/postgis/docker-postgis/blob/4eb614133d6aa87bfc5c952d24b7eb1f499e5c7c/12-3.0/Dockerfile

# init postgis
https://github.com/postgis/docker-postgis/blob/4eb614133d6aa87bfc5c952d24b7eb1f499e5c7c/12-3.0/initdb-postgis.sh

su postgres

docker build . --tag mapseedapi

docker run --name mapseedapi -p8010:8010 --net my-net -e DEBUG=True -e HOST=postgres2 -d mapseedapi


docker stop mapseedapi && docker rm mapseedapi


docker exec mapseedapi python src/manage.py migrate

docker exec -it mapseedapi python src/manage.py createsuperuser
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ RUN apt-get install -y python-dev python-distribute python-pip
RUN apt-get install -y python-psycopg2 postgresql libpq-dev postgresql-9.6-postgis-2.3 postgis postgresql-9.6

# If you want to deploy from an online host git repository, you can use the following command to clone:
RUN git clone https://github.com/mapseed/api.git && cd api && git checkout 1.7.0 && cd -
# RUN git clone https://github.com/mapseed/api.git && cd api && git checkout 1.7.0 && cd -
# # for local testing, cd into project root and uncomment this line:
# ADD . api
ADD . api

# Get pip to download and install requirements:
RUN pip install -r /api/requirements.txt
Expand All @@ -44,4 +44,4 @@ VOLUME /api/static
# CMD python server.py
# or:
# CMD sh -c "python src/manage.py collectstatic --noinput && gunicorn wsgi:application -w 3 -b 0.0.0.0:8010"
CMD /api/start.sh
CMD ["bash", "/api/start.sh"]
35 changes: 35 additions & 0 deletions QPR_MOD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Create users from frontend
===

Create Users from Frontend
--------------------------

We add a new endpoint to create users from frontend `https://<your-host>/api/v2/users/new`

You need to use a POST request this is a AJAX example

```javascript
const json = {username: "asdasd", "password1": "password"}
const response = await fetch(
`${apiRoot}users/new?format=json`, {
headers: {
"Content-Type": "application/json",
},
credentials: "include",
method: "POST",
body: json,
},
);
```

Backend
-------

In the backend you can add two new settings to decide what is the default dataset and GRoup to set to new created users from frontend.

local_settings.py

```python
DEFAULT_REGISTER_DATASET="quepasa-input"
DEFAULT_REGISTER_GROUP="administrators"
```
Loading