wip: geoip
This commit is contained in:
parent
95e5e92c41
commit
1594a78ab1
@ -1,4 +1,5 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from os import environ
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
@ -124,3 +125,7 @@ LOGGING = {
|
|||||||
"level": "WARNING",
|
"level": "WARNING",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#GEOIP_PATH = environ["GEOIP_PATH"]
|
||||||
|
#GEOIP_COUNTRY = "GeoIP.dat"
|
||||||
|
#GEOIP_CITY = "GeoIPCity.dat"
|
||||||
|
@ -7,7 +7,7 @@ class SignupAdmin(admin.ModelAdmin):
|
|||||||
_all_fields = ["email", "created_at", "anonymized_ip", "user_agent"]
|
_all_fields = ["email", "created_at", "anonymized_ip", "user_agent"]
|
||||||
|
|
||||||
date_hierarchy = "created_at"
|
date_hierarchy = "created_at"
|
||||||
list_display = ["email", "created_at", "anonymized_ip", "user_agent"]
|
list_display = ["email", "created_at", "anonymized_ip", "user_agent"]# + ["country"]
|
||||||
list_filter = ["email", "user_agent"]
|
list_filter = ["email", "user_agent"]
|
||||||
ordering = ["created_at"]
|
ordering = ["created_at"]
|
||||||
readonly_fields = _all_fields
|
readonly_fields = _all_fields
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
#from django.contrib.gis.geoip2 import GeoIP2
|
||||||
|
|
||||||
class Signup(models.Model):
|
class Signup(models.Model):
|
||||||
email = models.EmailField()
|
email = models.EmailField()
|
||||||
created_at = models.DateTimeField(auto_now_add = True)
|
created_at = models.DateTimeField(auto_now_add = True)
|
||||||
@ -13,3 +15,7 @@ class Signup(models.Model):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.email
|
return self.email
|
||||||
|
|
||||||
|
#def country(self):
|
||||||
|
# g = GeoIP2()
|
||||||
|
# return g.country(self.anonymized_ip)
|
||||||
|
@ -22,14 +22,14 @@
|
|||||||
python3Packages.django-compressor
|
python3Packages.django-compressor
|
||||||
dart-sass
|
dart-sass
|
||||||
|
|
||||||
hugo
|
geoipWithDatabase
|
||||||
brotli
|
python3Packages.geoip2
|
||||||
zopfli
|
libmaxminddb
|
||||||
parallel
|
|
||||||
];
|
];
|
||||||
in {
|
in {
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||||
|
GEOIP_PATH = "${pkgs.geolite-legacy}/share/GeoIP";
|
||||||
packages = devDeps;
|
packages = devDeps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user