diff --git a/.gitignore b/.gitignore index 4319204..7a51187 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ db.sqlite3 # System .DS_Store pxy_city_digital_twins/__backup__/ +Dockerfile.dev diff --git a/docker-compose.override.yml b/docker-compose.override.yml new file mode 100644 index 0000000..bacf022 --- /dev/null +++ b/docker-compose.override.yml @@ -0,0 +1,15 @@ +version: "3.8" + +services: + web: + build: + context: . + dockerfile: Dockerfile.dev + command: > + sh -c "python manage.py migrate && + python manage.py runserver 0.0.0.0:8000" + ports: + - "8011:8000" + volumes: + - .:/app + - ./staticfiles:/app/staticfiles diff --git a/polisplexity/settings.py b/polisplexity/settings.py index 6505f1d..3ac8643 100644 --- a/polisplexity/settings.py +++ b/polisplexity/settings.py @@ -19,14 +19,22 @@ ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS", "").split(",") # Application definition INSTALLED_APPS = [ + # Django built-in apps "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", + "django.contrib.sites", # Required for allauth - # App modules + # Allauth + "allauth", + "allauth.account", + "allauth.socialaccount", + "allauth.socialaccount.providers.github", # GitHub login only + + # Your custom apps "core", "pxy_de", "pxy_cr", @@ -42,14 +50,34 @@ INSTALLED_APPS = [ "pxy_dashboard.apps", "pxy_dashboard.components", "pxy_dashboard.layouts", + + # Third-party apps + "crispy_forms", + "crispy_bootstrap5", + ] +CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" +CRISPY_TEMPLATE_PACK = "bootstrap5" + +SITE_ID = 1 + +AUTHENTICATION_BACKENDS = [ + "django.contrib.auth.backends.ModelBackend", # default + "allauth.account.auth_backends.AuthenticationBackend", # allauth support +] + +LOGIN_REDIRECT_URL = "/" +ACCOUNT_LOGOUT_REDIRECT_URL = "/accounts/login/" + + MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", + "allauth.account.middleware.AccountMiddleware", # ← Add this line "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", ] @@ -59,7 +87,10 @@ ROOT_URLCONF = "polisplexity.urls" TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [os.path.join(BASE_DIR, "templates")], + "DIRS": [ + os.path.join(BASE_DIR, "templates"), + os.path.join(BASE_DIR, "pxy_dashboard", "templates"), + ], "APP_DIRS": True, "OPTIONS": { "context_processors": [ @@ -73,6 +104,8 @@ TEMPLATES = [ }, ] + + WSGI_APPLICATION = "polisplexity.wsgi.application" # Database @@ -132,3 +165,12 @@ CSRF_TRUSTED_ORIGINS = [ # Support for secure reverse proxy (e.g., Nginx or Hostinger HTTPS proxy) SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") + + +EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" +EMAIL_HOST = "smtp.hostinger.com" +EMAIL_PORT = 465 +EMAIL_USE_SSL = True +EMAIL_HOST_USER = "noreply@polisplexity.tech" # Cambia esto por tu correo real +EMAIL_HOST_PASSWORD = os.getenv("EMAIL_HOST_PASSWORD") # Mejor usar .env +DEFAULT_FROM_EMAIL = "Polisplexity " diff --git a/polisplexity/urls.py b/polisplexity/urls.py index 12eb325..db11adf 100644 --- a/polisplexity/urls.py +++ b/polisplexity/urls.py @@ -25,14 +25,15 @@ admin.site.index_title = "Welcome to Polisplexity City Technologies Portal" urlpatterns = [ path("admin/", admin.site.urls), + path("accounts/", include("allauth.urls")), # ← Add this line path('', include('pxy_dashboard.urls')), path('core', include('core.urls')), path('', include('pxy_city_digital_twins.urls')), path('pxy_whatsapp/', include('pxy_whatsapp.urls')), - path('bots/', include('pxy_bots.urls')), # Webhook URL: /bots/webhook// + path('bots/', include('pxy_bots.urls')), path('pxy_meta_pages/', include('pxy_meta_pages.urls', namespace='pxy_meta_pages')), - ] + if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) \ No newline at end of file diff --git a/pxy_dashboard/templates/account/login.html b/pxy_dashboard/templates/account/login.html new file mode 120000 index 0000000..9482607 --- /dev/null +++ b/pxy_dashboard/templates/account/login.html @@ -0,0 +1 @@ +../pxy_dashboard/account/login.html \ No newline at end of file diff --git a/pxy_dashboard/templates/pxy_dashboard/account/account_inactive.html b/pxy_dashboard/templates/pxy_dashboard/account/account_inactive.html index ca70623..a1f374f 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/account_inactive.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/account_inactive.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load i18n %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/email.html b/pxy_dashboard/templates/pxy_dashboard/account/email.html index 781b1cb..6dbabff 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/email.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/email.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load i18n %} {% load crispy_forms_tags %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/email_confirm.html b/pxy_dashboard/templates/pxy_dashboard/account/email_confirm.html index fcdb2cf..7f668b8 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/email_confirm.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/email_confirm.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load i18n %} {% load account %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/login.html b/pxy_dashboard/templates/pxy_dashboard/account/login.html index 9a8373b..cbf417e 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/login.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/login.html @@ -1,5 +1,6 @@ -{% extends "account/base.html" %} -{% load static crispy_forms_tags %} +{% extends "pxy_dashboard/account/base.html" %} +{% load static crispy_forms_tags socialaccount %} + {% block title %}Log In{% endblock title %} @@ -36,6 +37,16 @@

+{% load socialaccount %} + +{% if True %} + +{% endif %} +
{% csrf_token %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/logout.html b/pxy_dashboard/templates/pxy_dashboard/account/logout.html index c8cc94b..8bef177 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/logout.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/logout.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load i18n %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/password_change.html b/pxy_dashboard/templates/pxy_dashboard/account/password_change.html index f5ced34..58352f7 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/password_change.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/password_change.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load i18n %} {% load crispy_forms_tags %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/password_reset.html b/pxy_dashboard/templates/pxy_dashboard/account/password_reset.html index a70108c..6a5aa4f 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/password_reset.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/password_reset.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load static i18n crispy_forms_tags %} {% block title %}{% trans "Recover Password" %}{% endblock title %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/password_reset_done.html b/pxy_dashboard/templates/pxy_dashboard/account/password_reset_done.html index 5b006fe..1958d88 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/password_reset_done.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/password_reset_done.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load static i18n crispy_forms_tags %} {% block title %}{% trans "Password Reset" %}{% endblock title %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/password_reset_from_key.html b/pxy_dashboard/templates/pxy_dashboard/account/password_reset_from_key.html index bb86bd3..b8ee7a2 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/password_reset_from_key.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/password_reset_from_key.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load static i18n crispy_forms_tags %} {% block title %}{% trans "Change Password" %}{% endblock title %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/password_reset_from_key_done.html b/pxy_dashboard/templates/pxy_dashboard/account/password_reset_from_key_done.html index ba4037d..654b938 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/password_reset_from_key_done.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/password_reset_from_key_done.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load static i18n crispy_forms_tags %} {% block title %}{% trans "Change Password" %}{% endblock title %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/password_set.html b/pxy_dashboard/templates/pxy_dashboard/account/password_set.html index 0e9f705..ede0a52 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/password_set.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/password_set.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load i18n %} {% load crispy_forms_tags %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/signup.html b/pxy_dashboard/templates/pxy_dashboard/account/signup.html index 2caee5a..33d39ce 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/signup.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/signup.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load static i18n crispy_forms_tags %} {% block title %}{% trans "Register" %}{% endblock title %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/signup_closed.html b/pxy_dashboard/templates/pxy_dashboard/account/signup_closed.html index 180e935..d20cd48 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/signup_closed.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/signup_closed.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load i18n %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/verification_sent.html b/pxy_dashboard/templates/pxy_dashboard/account/verification_sent.html index ec2a070..3a6a2f8 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/verification_sent.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/verification_sent.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load i18n %} diff --git a/pxy_dashboard/templates/pxy_dashboard/account/verified_email_required.html b/pxy_dashboard/templates/pxy_dashboard/account/verified_email_required.html index 36cac97..0576fde 100644 --- a/pxy_dashboard/templates/pxy_dashboard/account/verified_email_required.html +++ b/pxy_dashboard/templates/pxy_dashboard/account/verified_email_required.html @@ -1,4 +1,4 @@ -{% extends "account/base.html" %} +{% extends "pxy_dashboard/account/base.html" %} {% load i18n %} diff --git a/pxy_dashboard/templates/pxy_dashboard/partials/footer.html b/pxy_dashboard/templates/pxy_dashboard/partials/footer.html index ef658f8..d36770a 100644 --- a/pxy_dashboard/templates/pxy_dashboard/partials/footer.html +++ b/pxy_dashboard/templates/pxy_dashboard/partials/footer.html @@ -3,7 +3,7 @@
- © Jidox - Coderthemes.com + © Polisplexity