diff --git a/roles/archweb/templates/local_settings.py.j2 b/roles/archweb/templates/local_settings.py.j2
index 47a1cda42ffa6c9a08e95035e6fc415d16053c6a..022e3d9cbae8cd00afd9d7f5cd86c53e174e6e20 100644
--- a/roles/archweb/templates/local_settings.py.j2
+++ b/roles/archweb/templates/local_settings.py.j2
@@ -15,9 +15,12 @@ DATABASES = {
     'default': {
         'ENGINE'  : 'django.db.backends.postgresql_psycopg2',
         'PORT'    : 5432,
-        'NAME'    : 'archweb',
-        'USER'    : 'archweb',
-        'PASSWORD': '{{ archweb_db_password }}',
+{% if archweb_db_host != 'localhost' %}
+        'HOST'    : '{{ archweb_db_host }}',
+{% endif %}
+        'NAME'    : '{{ archweb_db }}',
+        'USER'    : '{{ archweb_db_site_user }}',
+        'PASSWORD': '{{ archweb_db_site_password }}',
         'OPTIONS' : {'autocommit': True, 'application_name': 'archweb'},
     },
 }