GeoNode template project. Generates a django project with GeoNode support.
- Developer Workshop
- Create a custom project
- Start your server using Docker
- Run the instance in development mode
- Run the instance on a public site
- Stop the Docker Images
- Backup and Restore from Docker Images
- Recommended: Track your changes
- Hints: Configuring
requirements.txt
Available at
http://geonode.org/dev-workshop
NOTE: You can call your geonode project whatever you like following the naming conventions for python packages (generally lower case with underscores (_
). In the examples below, replace {{ project_name }}
with whatever you would like to name your project.
NOTE: Skip this part if you want to run the project using Docker instead
(see Start your server using Docker)
To setup your project using a local python virtual environment, follow these instructions:
-
Prepare the Environment
git clone https://github.com/GeoNode/geonode-project.git -b <your_branch> source /usr/share/virtualenvwrapper/virtualenvwrapper.sh mkvirtualenv --python=/usr/bin/python3 {{ project_name }} pip install Django==3.2 django-admin startproject --template=./geonode-project -e py,sh,md,rst,json,yml,ini,env,sample,properties -n monitoring-cron -n Dockerfile {{ project_name }} cd {{ project_name }}
-
Setup the Python Dependencies
NOTE: Important: modify your
requirements.txt
file, by adding theGeoNode
branch before continue!(see Hints: Configuring
requirements.txt
)pip install -r requirements.txt --upgrade pip install -e . --upgrade # Install GDAL Utilities for Python pip install pygdal=="`gdal-config --version`.*" # Dev scripts mv .override_dev_env.sample .override_dev_env mv manage_dev.sh.sample manage_dev.sh mv paver_dev.sh.sample paver_dev.sh # Using the Default Settings ./paver_dev.sh reset ./paver_dev.sh setup ./paver_dev.sh sync ./paver_dev.sh start
-
Access GeoNode from browser
NOTE: default admin user is
admin
(with pw:admin
)http://localhost:8000/
You need Docker 1.12 or higher, get the latest stable official release for your platform.
-
Prepare the Environment
git clone https://github.com/GeoNode/geonode-project.git -b <your_branch> source /usr/share/virtualenvwrapper/virtualenvwrapper.sh mkvirtualenv --python=/usr/bin/python3 {{ project_name }} pip install Django==3.2 django-admin startproject --template=./geonode-project -e py,sh,md,rst,json,yml,ini,env,sample,properties -n monitoring-cron -n Dockerfile {{ project_name }} cd {{ project_name }}
-
Run
docker-compose
to start it up (get a cup of coffee or tea while you wait)docker-compose build --no-cache docker-compose up -d
set COMPOSE_CONVERT_WINDOWS_PATHS=1
before running
docker-compose up
-
Access the site on http://localhost/
NOTE: In this example we are going to keep localhost as the target IP for GeoNode
docker-compose -f docker-compose.development.yml -f docker-compose.development.override.yml up
NOTE: In this example we are going to publish to the public IP http://123.456.789.111
vim .env
--> replace localhost with 123.456.789.111 everywhere
docker-compose up --build -d
docker-compose stop
WARNING: This will wipe out all the repositories created until now.
NOTE: The images must be stopped first
docker system prune -a
SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./{{project_name}}/br/backup.sh $BKP_FOLDER_NAME
-
BKP_FOLDER_NAME: Default value = backup_restore Shared Backup Folder name. The scripts assume it is located on "root" e.g.: /$BKP_FOLDER_NAME/
-
SOURCE_URL: Source Server URL, the one generating the "backup" file.
-
TARGET_URL: Target Server URL, the one which must be synched.
e.g.:
docker exec -it django4{{project_name}} sh -c 'SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./{{project_name}}/br/backup.sh $BKP_FOLDER_NAME'
SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./{{project_name}}/br/restore.sh $BKP_FOLDER_NAME
-
BKP_FOLDER_NAME: Default value = backup_restore Shared Backup Folder name. The scripts assume it is located on "root" e.g.: /$BKP_FOLDER_NAME/
-
SOURCE_URL: Source Server URL, the one generating the "backup" file.
-
TARGET_URL: Target Server URL, the one which must be synched.
e.g.:
docker exec -it django4{{project_name}} sh -c 'SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./{{project_name}}/br/restore.sh $BKP_FOLDER_NAME'
Step 1. Install Git (for Linux, Mac or Windows).
Step 2. Init git locally and do the first commit:
git init
git add *
git commit -m "Initial Commit"
Step 3. Set up a free account on github or bitbucket and make a copy of the repo there.
You may want to configure your requirements.txt, if you are using additional or custom versions of python packages. For example
Django==3.2
git+git://github.com/<your organization>/geonode.git@<your branch>