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))
|
||||
environ["E11SYNC_DEBUG_PRINTED"] = "1"
|
||||
|
||||
########################################
|
||||
## No more side effects after this place
|
||||
#######################################
|
||||
# No more side effects after this place
|
||||
|
||||
SECRET_KEY = _SECRET_KEY
|
||||
|
||||
|
@ -22,6 +22,7 @@ from django.conf import settings
|
||||
urlpatterns = [
|
||||
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')),
|
||||
]
|
||||
|
@ -3,6 +3,7 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
"""Run administrative tasks."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'e11sync.settings')
|
||||
|
@ -2,9 +2,16 @@ from django.contrib import admin
|
||||
|
||||
from .models import Signup
|
||||
|
||||
|
||||
@admin.register(Signup)
|
||||
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"
|
||||
list_display = ["email", "created_at", "user_agent"] + ["place_name"]
|
||||
|
@ -1,5 +1,6 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Signup(models.Model):
|
||||
email = models.EmailField()
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
@ -3,6 +3,7 @@ from django.urls import reverse
|
||||
|
||||
from .models import Signup
|
||||
|
||||
|
||||
class SignupViewTest(TestCase):
|
||||
def setUp(self):
|
||||
self.client = Client()
|
||||
|
11
flake.nix
11
flake.nix
@ -70,6 +70,12 @@
|
||||
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 = {
|
||||
@ -83,12 +89,15 @@
|
||||
|
||||
devShells.default = pkgs.mkShellNoCC {
|
||||
packages = with pkgs; [
|
||||
python3Packages.django-debug-toolbar
|
||||
python3Packages.django_5
|
||||
python3Packages.django-compressor
|
||||
python3Packages.geoip2
|
||||
libmaxminddb
|
||||
dart-sass
|
||||
|
||||
python3Packages.django-debug-toolbar
|
||||
python3Packages.flake8
|
||||
python3Packages.autopep8
|
||||
];
|
||||
GEOIP_PATH = "${geoip-archive}";
|
||||
E11SYNC_DEBUG = "1";
|
||||
|
Loading…
Reference in New Issue
Block a user