diff options
author | GitJournal <app@gitjournal.io> | 2024-10-07 13:29:58 -0500 |
---|---|---|
committer | GitJournal <app@gitjournal.io> | 2024-10-07 13:29:58 -0500 |
commit | a6fa6939969afde01bfcd3d60a8a525995bc6a38 (patch) | |
tree | fc2d72d2dbe3398438acdae3e6bbfb3be36f4169 | |
parent | c897b1641c1b8542c8da063b1f989412a4000ed5 (diff) |
Removed Note tech/set up geodjango on debian 7 digital ocean.txt
-rw-r--r-- | tech/set up geodjango on debian 7 digital ocean.txt | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/tech/set up geodjango on debian 7 digital ocean.txt b/tech/set up geodjango on debian 7 digital ocean.txt deleted file mode 100644 index 475c6eb..0000000 --- a/tech/set up geodjango on debian 7 digital ocean.txt +++ /dev/null @@ -1,98 +0,0 @@ -the first thing we need is python 3.4+ which I install by hand: - -prereqs: -sudo apt-get install build-essential libncursesw5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev libreadline6-dev - -wget https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz -tar -xvzf Python-3.4.1.tgz -cd Python-3.4.1 -./configure --prefix=/opt/python3 -make -sudo make altinstall - -Then we need postgres and the geospatial libs: - -apt-get install postgresql postgresql-contrib binutils libproj-dev gdal-bin - - - -postgis 2 i also do from source: - -wget http://download.osgeo.org/postgis/source/postgis-2.1.3.tar.gz -tar -xvzf postgis-2.1.3.tar.gz -cd postgis-2.1.3 - -preqs: - -apt-get install libpq-dev postgresql-server-dev-all libxml2 libgeos-dev libxml2-dev gdal-bin libgdal-dev - -./configure -make -sudo make install - -Then you just need to create a db user and database - -sudo su - postgres -createuser -P -s -e luxagraf - -The with regular user: -createdb luxagraf -U luxagraf -W -hlocalhost -psql -U luxagraf -W -hlocalhost -d luxagraf -and when you're in postgres: -CREATE EXTENSION postgis; - -Then just load the data: -psql -U luxagraf -W -hlocalhost -d luxagraf -f fullbak.sql (or whatever your backupfile is) - - -The last thing is a virtualenv for our project using python3.4 - -#make sure you use the right pip (included with python 3.4+) -sudo /opt/python3/bin/pip3.4 install virtualenv -then cd to proj dir and do: -/opt/python3/bin/virtualenv --distribute --python=/opt/python3/bin/python3-4 venv -then activate and install what you need - ---- -Once that's set up we need to connect gunicorn to nginx via supervisor. - - sudo apt-get install supervisor - -That will install and start supervisor. Let's add an init script so that supervisord starts up should the server need to reboot. so create the file - - /etc/init.d/supervisord - -And grab the appropriate [init script from the supervisor project](https://github.com/Supervisor/initscripts). I use the Debian script from that link. Paste that script into `/etc/init.d/supervisord` and save. Then make it executable: - - sudo chmod +x /etc/init.d/supervisord - -Now, make sure supervisor isn't running: - - supervisorctl shutdown - -And add supervisor to - -With Supervisor installed you can start and watch apps by creating configuration files in the `/etc/supervisor/conf.d` directory. You might do something like this, in, for example, `/etc/supervisor/conf.d/helloworld.conf`: - - [program:helloworld] - command = /home/<username>/apps/mydjangoapp/venv/bin/gunicorn -c /home/<username>/apps/mydjangoapp/config/gunicorn_config.py config.wsgi - directory = /home/<username>/apps/mydjangoapp/ - user = <non-privledged-user> - autostart = true - autorestart = true - stdout_logfile = /var/log/supervisor/helloworld.log - stderr_logfile = /var/log/supervisor/helloworld_err.log - -You'll need to fill in the correct paths based on your server setup, replacing <username> with your username and `mydjangoapp/etc...` with the actual path to the gunicorn app. This also assumes your gunicorn config file lives in `mydjangoapp/config/`. We'll get to that file in a minute. - -First, let's tell supervisor about our new app: - - sudo supervisorctl reread - -You should see a message `helloworld available`. So Supervisor knows about our app, let's actually add it. - - sudo supervisorctl update - -Now you should see a message that says something like `helloworld: added process group`. Supervisor is now aware of our hello world app and will make sure it automatically starts up whenever our server reboots. You can check the status of our gunicorn app with: - - sudo supervisorctl status
\ No newline at end of file |