django-modules-forms 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require('child_process');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ console.log('\n✨ Устанавливаем Django проект...\n');
8
+
9
+ const projectName = process.argv[2] || 'my-django-project';
10
+ const projectPath = path.join(process.cwd(), projectName);
11
+
12
+ console.log(`📁 Создаем проект в: ${projectPath}\n`);
13
+
14
+ function copyFiles(src, dest) {
15
+ if (!fs.existsSync(dest)) {
16
+ fs.mkdirSync(dest, { recursive: true });
17
+ }
18
+
19
+ const files = fs.readdirSync(src, { withFileTypes: true });
20
+
21
+ for (const file of files) {
22
+ if (file.name === 'venv' || file.name === '__pycache__' || file.name === 'db.sqlite3' || file.name === 'staticfiles') {
23
+ continue;
24
+ }
25
+ const srcPath = path.join(src, file.name);
26
+ const destPath = path.join(dest, file.name);
27
+
28
+ if (file.isDirectory()) {
29
+ copyFiles(srcPath, destPath);
30
+ } else {
31
+ fs.copyFileSync(srcPath, destPath);
32
+ }
33
+ }
34
+ }
35
+
36
+ copyFiles(__dirname, projectPath);
37
+
38
+ console.log('🐍 Создаем виртуальное окружение...');
39
+ execSync('python -m venv venv', { cwd: projectPath, stdio: 'inherit' });
40
+
41
+ console.log('📦 Устанавливаем зависимости...');
42
+ const pipCmd = process.platform === 'win32'
43
+ ? '.\\venv\\Scripts\\pip'
44
+ : './venv/bin/pip';
45
+ execSync(`${pipCmd} install django pillow django-admin-interface`, { cwd: projectPath, stdio: 'inherit' });
46
+
47
+ console.log('🗄️ Выполняем миграции...');
48
+ const pythonCmd = process.platform === 'win32'
49
+ ? '.\\venv\\Scripts\\python'
50
+ : './venv/bin/python';
51
+ execSync(`${pythonCmd} manage.py migrate`, { cwd: projectPath, stdio: 'inherit' });
52
+
53
+ console.log('🎨 Собираем статику...');
54
+ execSync(`${pythonCmd} manage.py collectstatic --noinput`, { cwd: projectPath, stdio: 'inherit' });
55
+
56
+ console.log('\n✅ Готово!\n');
57
+ console.log('🚀 Запусти проект:');
58
+ console.log(` cd ${projectName}`);
59
+ console.log(` .\\venv\\Scripts\\activate`);
60
+ console.log(' python manage.py runserver\n');
File without changes
@@ -0,0 +1,16 @@
1
+ """
2
+ ASGI config for kurochki project.
3
+
4
+ It exposes the ASGI callable as a module-level variable named ``application``.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/6.0/howto/deployment/asgi/
8
+ """
9
+
10
+ import os
11
+
12
+ from django.core.asgi import get_asgi_application
13
+
14
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'kurochki.settings')
15
+
16
+ application = get_asgi_application()
@@ -0,0 +1,116 @@
1
+ import os
2
+
3
+ from pathlib import Path
4
+
5
+ # Build paths inside the project like this: BASE_DIR / 'subdir'.
6
+ BASE_DIR = Path(__file__).resolve().parent.parent
7
+
8
+
9
+ # Quick-start development settings - unsuitable for production
10
+ # See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
11
+
12
+ # SECURITY WARNING: keep the secret key used in production secret!
13
+ SECRET_KEY = 'django-insecure-tmc!_x+_3(m(ij2h$g6lwo0#oarl8hy1q+l#&jxzyj&0^jrk^4'
14
+
15
+ # SECURITY WARNING: don't run with debug turned on in production!
16
+ DEBUG = True
17
+
18
+ ALLOWED_HOSTS = []
19
+
20
+
21
+ # Application definition
22
+
23
+ INSTALLED_APPS = [
24
+ 'django.contrib.admin',
25
+ 'django.contrib.auth',
26
+ 'django.contrib.contenttypes',
27
+ 'django.contrib.sessions',
28
+ 'django.contrib.messages',
29
+ 'django.contrib.staticfiles',
30
+ 'main'
31
+ ]
32
+ X_FRAME_OPTIONS = "SAMEORIGIN"
33
+ SILENCED_SYSTEM_CHECKS = ["security.W019"]
34
+ MIDDLEWARE = [
35
+ 'django.middleware.security.SecurityMiddleware',
36
+ 'django.contrib.sessions.middleware.SessionMiddleware',
37
+ 'django.middleware.common.CommonMiddleware',
38
+ 'django.middleware.csrf.CsrfViewMiddleware',
39
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
40
+ 'django.contrib.messages.middleware.MessageMiddleware',
41
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
42
+ ]
43
+
44
+ ROOT_URLCONF = 'kurochki.urls'
45
+
46
+ TEMPLATES = [
47
+ {
48
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
49
+ 'DIRS': [os.path.join(BASE_DIR, 'kurochki', 'templates')],
50
+ 'APP_DIRS': True,
51
+ 'OPTIONS': {
52
+ 'context_processors': [
53
+ 'django.template.context_processors.request',
54
+ 'django.contrib.auth.context_processors.auth',
55
+ 'django.contrib.messages.context_processors.messages',
56
+ ],
57
+ },
58
+ },
59
+ ]
60
+
61
+ WSGI_APPLICATION = 'kurochki.wsgi.application'
62
+
63
+
64
+ # Database
65
+ # https://docs.djangoproject.com/en/6.0/ref/settings/#databases
66
+
67
+ DATABASES = {
68
+ 'default': {
69
+ 'ENGINE': 'django.db.backends.sqlite3',
70
+ 'NAME': BASE_DIR / 'db.sqlite3',
71
+ }
72
+ }
73
+
74
+
75
+ # Password validation
76
+ # https://docs.djangoproject.com/en/6.0/ref/settings/#auth-password-validators
77
+
78
+ AUTH_PASSWORD_VALIDATORS = [
79
+ {
80
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
81
+ },
82
+ {
83
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
84
+ },
85
+ {
86
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
87
+ },
88
+ {
89
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
90
+ },
91
+ ]
92
+
93
+
94
+ # Internationalization
95
+ # https://docs.djangoproject.com/en/6.0/topics/i18n/
96
+
97
+ LANGUAGE_CODE = 'en-us'
98
+
99
+ TIME_ZONE = 'UTC'
100
+
101
+ USE_I18N = True
102
+
103
+ USE_TZ = True
104
+
105
+
106
+ # Static files (CSS, JavaScript, Images)
107
+ # https://docs.djangoproject.com/en/6.0/howto/static-files/
108
+
109
+ STATIC_URL = 'static/'
110
+ STATICFILES_DIRS = [os.path.join(BASE_DIR, 'kurochki', 'static')]
111
+ STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
112
+
113
+ AUTH_USER_MODEL = 'main.CustomUser'
114
+
115
+ LOGIN_REDIRECT_URL = '/'
116
+ LOGOUT_REDIRECT_URL = '/'