static config

This commit is contained in:
Francisco Rodriguez
2022-11-26 20:11:52 -07:00
parent 77d2b02a92
commit 1e6b924f7c
133 changed files with 30514 additions and 7 deletions

View File

@@ -0,0 +1,2 @@
import pymysql
pymysql.install_as_MySQLdb()

View File

@@ -93,12 +93,32 @@ ACCOUNT_SIGNUP_REDIRECT_URL =LOGIN_REDIRECT_URL
# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
DEBUG = True
if DEBUG:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'cfdi_as',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '127.0.0.1',
'PORT': '',
'OPTIONS': {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"},
},
}
else:
DATABASES={
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'fjrodriguez28$cfdi_as',
'USER': 'fjrodriguez28',
'PASSWORD': 'Nasus28@',
'HOST': 'fjrodriguez28.mysql.pythonanywhere-services.com',
'PORT': '3306',
'OPTIONS': {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"},
}
}
}
# Password validation
@@ -135,7 +155,26 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/
STATIC_URL = 'static/'
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

View File

@@ -1,9 +1,13 @@
from django.contrib import admin
from django.urls import path,include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('accounts/', include('allauth.urls')),
path('', include('Clientes.urls')),
]
if settings.DEBUG: #DEV only
urlpatterns += static(settings.STATIC_URL, document_root= settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root= settings.MEDIA_ROOT)