add flake8 for python
This commit is contained in:
parent
94626bb28b
commit
7db77e5b24
@ -34,8 +34,8 @@ if not environ.get("E11SYNC_DEBUG_PRINTED"):
|
|||||||
print("DATABASE_PATH={}".format(_DATABASE_PATH))
|
print("DATABASE_PATH={}".format(_DATABASE_PATH))
|
||||||
environ["E11SYNC_DEBUG_PRINTED"] = "1"
|
environ["E11SYNC_DEBUG_PRINTED"] = "1"
|
||||||
|
|
||||||
########################################
|
#######################################
|
||||||
## No more side effects after this place
|
# No more side effects after this place
|
||||||
|
|
||||||
SECRET_KEY = _SECRET_KEY
|
SECRET_KEY = _SECRET_KEY
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ from django.conf import settings
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
] + [
|
] + [
|
||||||
path("__debug__/", include("debug_toolbar.urls"))] if settings.DEBUG else [] + [
|
path("__debug__/", include("debug_toolbar.urls"))
|
||||||
|
] if settings.DEBUG else [] + [
|
||||||
path('', include('signup.urls')),
|
path('', include('signup.urls')),
|
||||||
]
|
]
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Run administrative tasks."""
|
"""Run administrative tasks."""
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'e11sync.settings')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'e11sync.settings')
|
||||||
|
@ -2,9 +2,16 @@ from django.contrib import admin
|
|||||||
|
|
||||||
from .models import Signup
|
from .models import Signup
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Signup)
|
@admin.register(Signup)
|
||||||
class SignupAdmin(admin.ModelAdmin):
|
class SignupAdmin(admin.ModelAdmin):
|
||||||
_all_fields = ["email", "created_at", "anonymized_ip", "user_agent", "geoip"]
|
_all_fields = [
|
||||||
|
"email",
|
||||||
|
"created_at",
|
||||||
|
"anonymized_ip",
|
||||||
|
"user_agent",
|
||||||
|
"geoip"
|
||||||
|
]
|
||||||
|
|
||||||
date_hierarchy = "created_at"
|
date_hierarchy = "created_at"
|
||||||
list_display = ["email", "created_at", "user_agent"] + ["place_name"]
|
list_display = ["email", "created_at", "user_agent"] + ["place_name"]
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
@ -3,6 +3,7 @@ from django.urls import reverse
|
|||||||
|
|
||||||
from .models import Signup
|
from .models import Signup
|
||||||
|
|
||||||
|
|
||||||
class SignupViewTest(TestCase):
|
class SignupViewTest(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.client = Client()
|
self.client = Client()
|
||||||
|
11
flake.nix
11
flake.nix
@ -70,6 +70,12 @@
|
|||||||
statix.enable = true;
|
statix.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
format = pkgs.runCommand "check-format" {} ''
|
||||||
|
${pkgs.python3Packages.flake8}/bin/flake8 \
|
||||||
|
--max-line-length 99 \
|
||||||
|
--exclude ${./.}/app/signup/migrations/ ${./.}
|
||||||
|
mkdir -p $out
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
apps.e11sync-gunicorn = {
|
apps.e11sync-gunicorn = {
|
||||||
@ -83,12 +89,15 @@
|
|||||||
|
|
||||||
devShells.default = pkgs.mkShellNoCC {
|
devShells.default = pkgs.mkShellNoCC {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
python3Packages.django-debug-toolbar
|
|
||||||
python3Packages.django_5
|
python3Packages.django_5
|
||||||
python3Packages.django-compressor
|
python3Packages.django-compressor
|
||||||
python3Packages.geoip2
|
python3Packages.geoip2
|
||||||
libmaxminddb
|
libmaxminddb
|
||||||
dart-sass
|
dart-sass
|
||||||
|
|
||||||
|
python3Packages.django-debug-toolbar
|
||||||
|
python3Packages.flake8
|
||||||
|
python3Packages.autopep8
|
||||||
];
|
];
|
||||||
GEOIP_PATH = "${geoip-archive}";
|
GEOIP_PATH = "${geoip-archive}";
|
||||||
E11SYNC_DEBUG = "1";
|
E11SYNC_DEBUG = "1";
|
||||||
|
Loading…
Reference in New Issue
Block a user