Function Words in Philippine Languages. Stack: Django, PostgreSQL. Now production ready with Gunicorn and Nginx.
- Make sure you have Docker and Make installed.
- Run the following commands:
# Build and start the application
make build
make up
# Or start in detached mode (e.g., in production)
make up-dThen http://localhost should now work, but without any "design" because static files like CSS are not loaded yet.
- Have another terminal tab/window, then run the following commands:
make makemigrations-fwapp # run this once only. afterwards, run 'make makemigrations' instead.
make migrate
make static
# replace "funcwords" with the name of directory where this is located
docker exec -i funcwords-db-1 psql -U user0 -d Function_Words < ./triggers.sqlFor data, see Data Dump section below.
Note that the "funcwords" in funcwords-db-1 is the name of the directory of this repo, thus change this appropriately if the directory name is different.
- Grind to have some money (😫) to buy a VPS (ideally Ubuntu with Docker installed) and a domain. Then follow the steps provided by the VPS provider to connect the two.
- Modify
.envwith secure values. SetDEBUGto False andDJANGO_ALLOWED_HOSTSto your domain with dot in the beginning, like.example.com. Replace every instance ofexample.comin this repo with your domain. - Uncomment the
.envin.gitignore. Do NOT upload prod environment variables anywhere! - (Update: I now prefer pulling from Github.) Copy files from local to VPS using rsync:
rsync -avz . root@<VPS IP address>:~/the-app --exclude .git/This assumes that the current directory of terminal is this repo. Note that the-app directory will be created in the home directory (~) of the user (root in the case of the command above) in VPS, and the files will be copied to that directory.
- (Update: I now prefer decoupling Nginx.) SSH to your VPS:
ssh root@<VPS IP address>. After login, you'll be in home directory. Go tothe-appdirectory and do the Docker setup above. Website should now be up! But it's in HTTP. - HTTP Secure (HTTPS) configuration in
docker-compose.yml,settings.py, andnginx.confare commented. Follow this to create SSL certificate except do
sudo certbot certonly --webroot -w /var/www/certbot/ -d example.comfor getting the certificate. Through webroot, certbot can automatically renew without needing to stop containers.
This is a ZIP file of the Django JSON data dump, occassionally updated. Download here (Mega folder).
This work is licensed under a Creative Commons Attribution 4.0 International License.
- We provide a Makefile for common commands for development.
- Docker shell:
make shell- Django shell:
make django-shell- PostgreSQL command line:
docker exec -it funcwords-db-1 psql -d Function_Words -U user0- Want to insert data or run Python scripts "from outside"? Here is a tutorial.
Distributed under the MIT software license. See the accompanying file LICENSE or https://opensource.org/license/mit/.
