2 years ago
I've encountered the following error during deployment of a django project on railway. It seems the error is related to the start of the application, this is the current configuration used. Thank you in advance for any help you are able to provide. This is my first time deploying on railway. Thanks!
<>
web: gunicorn config.wsgi
<>
python-3.12.2
<>
from pathlib import Path
import os
from dotenv import loaddotenv import djdatabase_url
load_dotenv()
BASE_DIR = Path(file).resolve().parent.parent
SECRET_KEY = os.getenv('DJNKEY')
DEBUG = False
ENVIRONMENT = (os.getenv('ENVIRONMENT'))
ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'eventhub.up.railway.app']
CSRFTRUSTEDORIGINS = ['https://eventhub.up.railway.app']
SITE_ID = 1
n
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'events',
'userauth',
'reportlab',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.google',
]
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',
'allauth.account.middleware.AccountMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
]
ACCOUNTADAPTER = 'userauth.adapter.CustomAccountAdapter' SOCIALACCOUNTADAPTER = 'userauth.adapter.CustomSocialAccountAdapter'
ROOT_URLCONF = 'config.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'APPDIRS': True, 'OPTIONS': { 'contextprocessors': [
'django.template.contextprocessors.debug', 'django.template.contextprocessors.request',
'django.contrib.auth.contextprocessors.auth', 'django.contrib.messages.contextprocessors.messages',
'events.contextprocessor.customcontext',
],
},
},
]
WSGI_APPLICATION = 'config.wsgi.application'
DATABASES = {
'default': {
'ENGINE':'django.db.backends.postgresql',
'NAME': os.getenv('PGDATABASE'),
'USER': os.getenv('PGUSER'),
'PASSWORD': os.getenv('PGPASSWORD'),
'HOST': os.getenv('PGHOST'),
'PORT': os.getenv('PGPORT'),
}
}
POSTGRESLOCALLY = False if ENVIRONMENT == 'production' or POSTGRESLOCALLY == True:
DATABASES['default'] = djdatabaseurl.parse(os.getenv('DBURL'))
AUTHENTICATIONBACKENDS = [ 'django.contrib.auth.backends.ModelBackend', 'allauth.account.authbackends.AuthenticationBackend',
]
AUTHPASSWORDVALIDATORS = [
{
'NAME': 'django.contrib.auth.passwordvalidation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.passwordvalidation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.passwordvalidation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.passwordvalidation.NumericPasswordValidator',
},
]
EMAILBACKEND = os.getenv('EBACKEND') EMAILHOST = os.getenv('EHOST')
EMAILHOSTUSER = os.getenv('EHOSTUSER')
EMAILHOSTPASSWORD = os.getenv('EHOSTPASS')
EMAILPORT = 587 EMAILUSETLS = bool(os.getenv('ETLS')) DEFAULTFROM_EMAIL = os.getenv('DEFAULTFROMEMAIL')
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
STATIC_URL = '/static/'
STATICROOT = os.path.join(BASEDIR, 'staticfiles')
STATICPROJECTDIR = os.path.join(BASEDIR, 'static') STYLESDIR = os.path.join(STATICPROJECTDIR, 'styles')
STATICFILESDIRS = [ STATICPROJECTDIR, STYLESDIR,
]
MEDIAURL = '/media/' MEDIAROOT = (os.path.join(BASE_DIR, 'media/'))
DEFAULTAUTOFIELD = 'django.db.models.BigAutoField'
LOGINREDIRECTURL = '/'
LOGOUTREDIRECTURL = '/'
> ⓘ Deployment information is only viewable by project members and Railway employees.
6 Replies
2 years ago
I've encountered the following error during deployment of a django project on railway.
What error?
2 years ago
This is the error logged on railway (build)
[Region: us-west1]
Using Nixpacks
context: ad9abeb1a3b0f5cf7dcd416800646523
Nixpacks build failed
╔══════════════════════════════ Nixpacks v1.24.0 ══════════════════════════════╗
║ setup │ python312, postgresql, gcc ║
║──────────────────────────────────────────────────────────────────────────────║
║ install │ python -m venv --copies /opt/venv && . /opt/venv/bin/activate ║
║ │ && pip install -r requirements.txt ║
║──────────────────────────────────────────────────────────────────────────────║
║ start │ ║
╚══════════════════════════════════════════════════════════════════════════════╝
Error: No start command could be found
2 years ago
Yes
2 years ago
all solved now, thank you so much for your help !