Jump to content

tdevries

Members
  • Posts

    9
  • Joined

  • Last visited

tdevries's Achievements

Rookie

Rookie (2/14)

  • Dedicated Rare
  • Reacting Well Rare
  • First Post Rare
  • Conversation Starter Rare
  • Week One Done Rare

Recent Badges

0

Reputation

  1. Hi Krydos, Could you add it to Tommy2 as well? I am helping my dad set up his website using django. Thanks in advance!
  2. Hi, Is it possible for the "django-environ" python module to be added to Tommy2? Thanks in advance! Kind regards, tdevries
  3. I changed the host, port and ssl settings as you described. I am still getting the authentication error. Do I perhaps have to check the box that says: "Can be used to log in to Plesk (username: test@tdevries.helioho.st)" to use the smtp mail?
  4. Hi, I am trying to set up an automatic email function in Django, I added an email account in plesk and entered the values provided in Django settings.py: EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST='tdevries.helioho.st' EMAIL_PORT=465 EMAIL_HOST_USER='test@tdevries.helioho.st' EMAIL_HOST_PASSWORD=***** EMAIL_USE_SSL=True I disabled incoming mail and Plesk login for this mailaddress. I merely want to use it to send a confirmation mail. I made sure that the passwords match on Plesk and Django, however, I am getting an authentication error. Am I overlooking something? Kind regards, tdevries
  5. Hi, I am currently trying to deploy a django webapp to my website on the Tommy server. I have just completed the tutorial in the Django docs, and followed the tutorial on django app deployment on HelioNet. Currently, the webpage does load and index.html is rendered, however, the static files are not found by django. The error I get is a 404: www.mysite.com/static/App/css/bootstrap.css is not found. However the bootstrap.css is in that folder on my website, I am relatively new to this, so I don't really understand why my files can't be found... Does anyone know what might cause this error? Thanks in advance! I have pasted some relevant (I think) files below and my file structure is as follows: public_html/ Project/ __init__.py asgi.py dispatch.wsgi settings.py urls.py wsgi.py App/ migrations/ static/ App/ --bunch of static files templates/ index.html __init.py admin.py apps.py models.py tests.py urls.py views.py static/ App/ --bunch of static files admin/ --bunch of static files manage.py .htaccess #index.html {% load static %} <!-- Bootstrap css --> <link rel="stylesheet" href="{% static 'App/css/bootstrap.css' %}"> #settings.py from pathlib import Path # 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.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = "django-insecure-3-*qt4@^g@_$*$x483w@2)1_iw5y9e36vag$j$@zqul2zrap2e" # 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.staticfiles", "App.apps.AppConfig" ] 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 = "Project.urls" TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", "DIRS": [], "APP_DIRS": True, "OPTIONS": { "context_processors": [ "django.template.context_processors.debug", "django.template.context_processors.request", "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", ], }, }, ] WSGI_APPLICATION = "Project.wsgi.application" # Database # https://docs.djangoproject.com/en/4.2/ref/settings/#databases DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": BASE_DIR / "db.sqlite3", } } # Password validation # https://docs.djangoproject.com/en/4.2/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.2/topics/i18n/ LANGUAGE_CODE = "en-us" TIME_ZONE = "UTC" USE_I18N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.2/howto/static-files/ STATIC_URL = "static/" STATIC_ROOT = "static/" # Default primary key field type # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" #App/urls.py from django.urls import path from . import views urlpatterns = [ path("", views.index, name="index"), ] #Project/urls.py from django.conf import settings from django.contrib import admin from django.urls import path, include urlpatterns = [ path("admin/", admin.site.urls), path("App/", include("App.urls")), path("accounts/", include("django.contrib.auth.urls")), ] #views.py from django.shortcuts import render def index(request): return render(request, "App/index.html") #dispatch.wsgi import os, sys # edit your username below sys.path.append("/home/username_on_heliohost/public_html/") from django.core.wsgi import get_wsgi_application os.environ['DJANGO_SETTINGS_MODULE'] = 'Project.settings' application = get_wsgi_application() # .htaccess RewriteEngine On RewriteBase / RewriteRule ^(media/.*)$ - [L] RewriteRule ^(admin_media/.*)$ - [L] RewriteRule ^(Project/dispatch\.wsgi/.*)$ - [L] RewriteRule ^(.*)$ Project/dispatch.wsgi/$1 [QSA,PT,L]
  6. Hi, I am building a simple webapp with Flask (python) for the first time and want to connect to a database using SQLAlchemy. Currently I have to provide a string such as: "mysql://username:password@host/database_name?charset=utf8mb4" to connect to the database. However, it seems to me that it is not very secure to just have the username, password, etc. just in a simple string in the code? Is there any way to keep these values hidden or to securely connect to the database without the need to show these values? Thanks in advance!
×
×
  • Create New...