We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add requirement about projection units : should be meters
http://gis.stackexchange.com/questions/85955/how-can-i-obtain-the-unit-of-a-projection-srid


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `geotrek/common/__init__.py`
Content:
```
1 """
2 
3     Geotrek startup script.
4 
5     This is executed only once at startup.
6 
7 """
8 from south.signals import post_migrate
9 from django.conf import settings
10 from django.db.models.signals import post_syncdb
11 
12 from mapentity.helpers import api_bbox
13 
14 from geotrek.common.utils.postgresql import load_sql_files
15 
16 
17 """
18     http://djangosnippets.org/snippets/2311/
19     Ensure South will update our custom SQL during a call to `migrate`.
20 """
21 
22 def run_initial_sql_post_migrate(sender, **kwargs):
23     app_label = kwargs.get('app')
24     load_sql_files(app_label)
25 
26 
27 def run_initial_sql_post_syncdb(sender, **kwargs):
28     app = kwargs.get('app')
29     models_module = app.__name__
30     app_label = models_module.rsplit('.')[-2]
31     load_sql_files(app_label)
32 
33 
34 if settings.TEST and not settings.SOUTH_TESTS_MIGRATE:
35     post_syncdb.connect(run_initial_sql_post_syncdb, dispatch_uid="geotrek.core.sqlautoload")
36     # During tests, the signal is received twice unfortunately
37     # https://code.djangoproject.com/ticket/17977
38 else:
39     post_migrate.connect(run_initial_sql_post_migrate, dispatch_uid="geotrek.core.sqlautoload")
40 
41 
42 """
43     Computed client-side setting.
44 """
45 settings.LEAFLET_CONFIG['SPATIAL_EXTENT'] = api_bbox(settings.SPATIAL_EXTENT, buffer=0.5)
46
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/geotrek/common/__init__.py b/geotrek/common/__init__.py
--- a/geotrek/common/__init__.py
+++ b/geotrek/common/__init__.py
@@ -5,9 +5,11 @@
     This is executed only once at startup.
 
 """
-from south.signals import post_migrate
+from south.signals import pre_migrate, post_migrate
 from django.conf import settings
-from django.db.models.signals import post_syncdb
+from django.db import connection
+from django.db.models.signals import pre_syncdb, post_syncdb
+from django.core.exceptions import ImproperlyConfigured
 
 from mapentity.helpers import api_bbox
 
@@ -31,11 +33,26 @@
     load_sql_files(app_label)
 
 
+def check_srid_has_meter_unit(sender, **kwargs):
+    if not hasattr(check_srid_has_meter_unit, '_checked'):
+        cursor = connection.cursor()
+        cursor.execute("""
+            SELECT * FROM spatial_ref_sys
+            WHERE srtext ILIKE '%%meter%%' AND srid=%s;""", [settings.SRID])
+        results = cursor.fetchall()
+        if len(results) == 0:
+            err_msg = 'Unit of SRID EPSG:%s is not meter.' % settings.SRID
+            raise ImproperlyConfigured(err_msg)
+    check_srid_has_meter_unit._checked = True
+
+
 if settings.TEST and not settings.SOUTH_TESTS_MIGRATE:
+    pre_syncdb.connect(check_srid_has_meter_unit, dispatch_uid="geotrek.core.checksrid")
     post_syncdb.connect(run_initial_sql_post_syncdb, dispatch_uid="geotrek.core.sqlautoload")
     # During tests, the signal is received twice unfortunately
     # https://code.djangoproject.com/ticket/17977
 else:
+    pre_migrate.connect(check_srid_has_meter_unit, dispatch_uid="geotrek.core.checksrid")
     post_migrate.connect(run_initial_sql_post_migrate, dispatch_uid="geotrek.core.sqlautoload")

{"golden_diff": "diff --git a/geotrek/common/__init__.py b/geotrek/common/__init__.py\n--- a/geotrek/common/__init__.py\n+++ b/geotrek/common/__init__.py\n@@ -5,9 +5,11 @@\n     This is executed only once at startup.\n \n \"\"\"\n-from south.signals import post_migrate\n+from south.signals import pre_migrate, post_migrate\n from django.conf import settings\n-from django.db.models.signals import post_syncdb\n+from django.db import connection\n+from django.db.models.signals import pre_syncdb, post_syncdb\n+from django.core.exceptions import ImproperlyConfigured\n \n from mapentity.helpers import api_bbox\n \n@@ -31,11 +33,26 @@\n     load_sql_files(app_label)\n \n \n+def check_srid_has_meter_unit(sender, **kwargs):\n+    if not hasattr(check_srid_has_meter_unit, '_checked'):\n+        cursor = connection.cursor()\n+        cursor.execute(\"\"\"\n+            SELECT * FROM spatial_ref_sys\n+            WHERE srtext ILIKE '%%meter%%' AND srid=%s;\"\"\", [settings.SRID])\n+        results = cursor.fetchall()\n+        if len(results) == 0:\n+            err_msg = 'Unit of SRID EPSG:%s is not meter.' % settings.SRID\n+            raise ImproperlyConfigured(err_msg)\n+    check_srid_has_meter_unit._checked = True\n+\n+\n if settings.TEST and not settings.SOUTH_TESTS_MIGRATE:\n+    pre_syncdb.connect(check_srid_has_meter_unit, dispatch_uid=\"geotrek.core.checksrid\")\n     post_syncdb.connect(run_initial_sql_post_syncdb, dispatch_uid=\"geotrek.core.sqlautoload\")\n     # During tests, the signal is received twice unfortunately\n     # https://code.djangoproject.com/ticket/17977\n else:\n+    pre_migrate.connect(check_srid_has_meter_unit, dispatch_uid=\"geotrek.core.checksrid\")\n     post_migrate.connect(run_initial_sql_post_migrate, dispatch_uid=\"geotrek.core.sqlautoload\")\n", "issue": "Add requirement about projection units : should be meters\nhttp://gis.stackexchange.com/questions/85955/how-can-i-obtain-the-unit-of-a-projection-srid\n\n", "before_files": [{"content": "\"\"\"\n\n    Geotrek startup script.\n\n    This is executed only once at startup.\n\n\"\"\"\nfrom south.signals import post_migrate\nfrom django.conf import settings\nfrom django.db.models.signals import post_syncdb\n\nfrom mapentity.helpers import api_bbox\n\nfrom geotrek.common.utils.postgresql import load_sql_files\n\n\n\"\"\"\n    http://djangosnippets.org/snippets/2311/\n    Ensure South will update our custom SQL during a call to `migrate`.\n\"\"\"\n\ndef run_initial_sql_post_migrate(sender, **kwargs):\n    app_label = kwargs.get('app')\n    load_sql_files(app_label)\n\n\ndef run_initial_sql_post_syncdb(sender, **kwargs):\n    app = kwargs.get('app')\n    models_module = app.__name__\n    app_label = models_module.rsplit('.')[-2]\n    load_sql_files(app_label)\n\n\nif settings.TEST and not settings.SOUTH_TESTS_MIGRATE:\n    post_syncdb.connect(run_initial_sql_post_syncdb, dispatch_uid=\"geotrek.core.sqlautoload\")\n    # During tests, the signal is received twice unfortunately\n    # https://code.djangoproject.com/ticket/17977\nelse:\n    post_migrate.connect(run_initial_sql_post_migrate, dispatch_uid=\"geotrek.core.sqlautoload\")\n\n\n\"\"\"\n    Computed client-side setting.\n\"\"\"\nsettings.LEAFLET_CONFIG['SPATIAL_EXTENT'] = api_bbox(settings.SPATIAL_EXTENT, buffer=0.5)\n", "path": "geotrek/common/__init__.py"}], "after_files": [{"content": "\"\"\"\n\n    Geotrek startup script.\n\n    This is executed only once at startup.\n\n\"\"\"\nfrom south.signals import pre_migrate, post_migrate\nfrom django.conf import settings\nfrom django.db import connection\nfrom django.db.models.signals import pre_syncdb, post_syncdb\nfrom django.core.exceptions import ImproperlyConfigured\n\nfrom mapentity.helpers import api_bbox\n\nfrom geotrek.common.utils.postgresql import load_sql_files\n\n\n\"\"\"\n    http://djangosnippets.org/snippets/2311/\n    Ensure South will update our custom SQL during a call to `migrate`.\n\"\"\"\n\ndef run_initial_sql_post_migrate(sender, **kwargs):\n    app_label = kwargs.get('app')\n    load_sql_files(app_label)\n\n\ndef run_initial_sql_post_syncdb(sender, **kwargs):\n    app = kwargs.get('app')\n    models_module = app.__name__\n    app_label = models_module.rsplit('.')[-2]\n    load_sql_files(app_label)\n\n\ndef check_srid_has_meter_unit(sender, **kwargs):\n    if not hasattr(check_srid_has_meter_unit, '_checked'):\n        cursor = connection.cursor()\n        cursor.execute(\"\"\"\n            SELECT * FROM spatial_ref_sys\n            WHERE srtext ILIKE '%%meter%%' AND srid=%s;\"\"\", [settings.SRID])\n        results = cursor.fetchall()\n        if len(results) == 0:\n            err_msg = 'Unit of SRID EPSG:%s is not meter.' % settings.SRID\n            raise ImproperlyConfigured(err_msg)\n    check_srid_has_meter_unit._checked = True\n\n\nif settings.TEST and not settings.SOUTH_TESTS_MIGRATE:\n    pre_syncdb.connect(check_srid_has_meter_unit, dispatch_uid=\"geotrek.core.checksrid\")\n    post_syncdb.connect(run_initial_sql_post_syncdb, dispatch_uid=\"geotrek.core.sqlautoload\")\n    # During tests, the signal is received twice unfortunately\n    # https://code.djangoproject.com/ticket/17977\nelse:\n    pre_migrate.connect(check_srid_has_meter_unit, dispatch_uid=\"geotrek.core.checksrid\")\n    post_migrate.connect(run_initial_sql_post_migrate, dispatch_uid=\"geotrek.core.sqlautoload\")\n\n\n\"\"\"\n    Computed client-side setting.\n\"\"\"\nsettings.LEAFLET_CONFIG['SPATIAL_EXTENT'] = api_bbox(settings.SPATIAL_EXTENT, buffer=0.5)\n", "path": "geotrek/common/__init__.py"}]}