reCreateIMMEX
This commit is contained in:
@@ -12,7 +12,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = os.getenv("adminAS_KEY")
|
SECRET_KEY = os.getenv("adminAS_KEY")
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|||||||
215
Admin/settingsLocal.py
Normal file
215
Admin/settingsLocal.py
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import os
|
||||||
|
import pytz
|
||||||
|
#print time zones
|
||||||
|
# for x in pytz.all_timezones_set:
|
||||||
|
# print(x)
|
||||||
|
|
||||||
|
|
||||||
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
# Quick-start development settings - unsuitable for production
|
||||||
|
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = 'asdasd'#os.getenv("adminAS_KEY")
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = ['*']
|
||||||
|
# Application definition
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
#'django.contrib.sites',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'rest_framework',
|
||||||
|
'rest_framework.authtoken',
|
||||||
|
|
||||||
|
'allauth',
|
||||||
|
'allauth.account',
|
||||||
|
'allauth.socialaccount',
|
||||||
|
|
||||||
|
'widget_tweaks',
|
||||||
|
|
||||||
|
'Clientes',
|
||||||
|
'IMMEX',
|
||||||
|
'Sistemas',
|
||||||
|
]
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': [
|
||||||
|
'rest_framework.authentication.TokenAuthentication',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
SITE_ID = 1
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
ROOT_URLCONF = 'Admin.urls'
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [os.path.join(BASE_DIR,'Templates')],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.debug',
|
||||||
|
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
# `allauth` needs this from django
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
#custom context processor
|
||||||
|
'Clientes.saldo_context_proc.get_saldo',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
AUTHENTICATION_BACKENDS = [
|
||||||
|
|
||||||
|
# Needed to login by username in Django admin, regardless of `allauth`
|
||||||
|
'django.contrib.auth.backends.ModelBackend',
|
||||||
|
|
||||||
|
# `allauth` specific authentication methods, such as login by e-mail
|
||||||
|
'allauth.account.auth_backends.AuthenticationBackend',
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'Admin.wsgi.application'
|
||||||
|
ACCOUNT_FORMS = {
|
||||||
|
'login': 'allauth.account.forms.LoginForm',
|
||||||
|
'signup': 'allauth.account.forms.SignupForm',
|
||||||
|
'add_email': 'allauth.account.forms.AddEmailForm',
|
||||||
|
'change_password': 'allauth.account.forms.ChangePasswordForm',
|
||||||
|
'set_password': 'allauth.account.forms.SetPasswordForm',
|
||||||
|
'reset_password': 'allauth.account.forms.ResetPasswordForm',
|
||||||
|
'reset_password_from_key': 'allauth.account.forms.ResetPasswordKeyForm',
|
||||||
|
'disconnect': 'allauth.socialaccount.forms.DisconnectForm',
|
||||||
|
}
|
||||||
|
LOGIN_REDIRECT_URL = '/'
|
||||||
|
ACCOUNT_LOGOUT_REDIRECT_URL = '/accounts/login/'
|
||||||
|
ACCOUNT_SIGNUP_REDIRECT_URL =LOGIN_REDIRECT_URL
|
||||||
|
ACCOUNT_LOGOUT_ON_PASSWORD_CHANGE = True
|
||||||
|
#for email auth
|
||||||
|
ACCOUNT_EMAIL_REQUIRED =True
|
||||||
|
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
|
||||||
|
|
||||||
|
EMAIL_TIMEOUT = 10
|
||||||
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||||
|
EMAIL_SUBJECT_PREFIX = 'AS Timbres'
|
||||||
|
# if DEBUG :
|
||||||
|
EMAIL_USE_TLS = True
|
||||||
|
EMAIL_HOST = 'smtp.gmail.com'
|
||||||
|
EMAIL_PORT = 587
|
||||||
|
EMAIL_HOST_USER = 'aduanasoftpruebas@gmail.com'
|
||||||
|
EMAIL_HOST_PASSWORD = 'zsgtbxsuwyacyhqq'#os.getenv("test_pwd_email")
|
||||||
|
#EMAIL_USE_SSL=False
|
||||||
|
# else:
|
||||||
|
# EMAIL_USE_TLS = True
|
||||||
|
# EMAIL_HOST = 'secure.emailsrvr.com'
|
||||||
|
# EMAIL_PORT = 465
|
||||||
|
# EMAIL_HOST_USER = 'noreply@aduanasoft.com.mx'
|
||||||
|
# EMAIL_HOST_PASSWORD = 'N036p7y!'#os.getenv("pwd_email")
|
||||||
|
# #EMAIL_USE_SSL=True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if DEBUG:
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
|
'NAME': 'cfdi_as2',
|
||||||
|
'USER': 'root',
|
||||||
|
'PASSWORD':'bardo28',#os.getenv("BD_PASS"),
|
||||||
|
'HOST': '127.0.0.1',
|
||||||
|
'PORT': '',
|
||||||
|
'OPTIONS': {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
DATABASES={
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
|
'NAME': 'Aduanasoft$cfdi_as',
|
||||||
|
'USER': 'Aduanasoft',
|
||||||
|
'PASSWORD':'Soluciones28@',
|
||||||
|
'HOST': 'Aduanasoft.mysql.pythonanywhere-services.com',
|
||||||
|
'PORT': '3306',
|
||||||
|
'OPTIONS': {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/4.1/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'es-MX'
|
||||||
|
|
||||||
|
TIME_ZONE = 'America/Chihuahua'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/4.1/howto/static-files/
|
||||||
|
|
||||||
|
if not DEBUG:
|
||||||
|
#STATIC_ROOT = os.path.join(BASE_DIR, "static")
|
||||||
|
STATICFILES_DIRS = [
|
||||||
|
BASE_DIR / 'static'
|
||||||
|
]
|
||||||
|
|
||||||
|
MEDIA_URL = '/media/'
|
||||||
|
MEDIA_ROOT = BASE_DIR / 'media'
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
if DEBUG:
|
||||||
|
|
||||||
|
STATICFILES_DIRS = [
|
||||||
|
BASE_DIR / 'static',
|
||||||
|
]
|
||||||
|
MEDIA_URL = '/media/'
|
||||||
|
MEDIA_ROOT = BASE_DIR / 'media'
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
#STATIC_ROOT = os.path.join(BASE_DIR, "static")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
20
IMMEX/migrations/0002_alter_devicea24_token.py
Normal file
20
IMMEX/migrations/0002_alter_devicea24_token.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Generated by Django 4.1.3 on 2023-05-25 14:11
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('authtoken', '0003_tokenproxy'),
|
||||||
|
('IMMEX', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='devicea24',
|
||||||
|
name='token',
|
||||||
|
field=models.ForeignKey(blank=True, max_length=40, null=True, on_delete=django.db.models.deletion.CASCADE, to='authtoken.token'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -30,7 +30,7 @@ class DeviceA24(models.Model):
|
|||||||
deviceName = models.CharField(max_length=255)
|
deviceName = models.CharField(max_length=255)
|
||||||
deviceOS = models.CharField(max_length=255)
|
deviceOS = models.CharField(max_length=255)
|
||||||
deviceIP = models.GenericIPAddressField()
|
deviceIP = models.GenericIPAddressField()
|
||||||
token = models.ForeignKey(Token, on_delete=models.CASCADE, blank=True,null=True)
|
token = models.ForeignKey(Token, on_delete=models.CASCADE,to_field='key', max_length=40, blank=True,null=True)
|
||||||
username = models.ForeignKey(User, on_delete=models.CASCADE)
|
username = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
sistema = models.ForeignKey(Sistema, on_delete=models.CASCADE)
|
sistema = models.ForeignKey(Sistema, on_delete=models.CASCADE)
|
||||||
MAC = models.CharField(max_length=30, blank=True, null=True)
|
MAC = models.CharField(max_length=30, blank=True, null=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user