Failed deployment using django/postgres, start application issue
davidpal3c
TRIALOP

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 load_dotenv

import dj_database_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']

CSRF_TRUSTED_ORIGINS = ['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',

]

ACCOUNT_ADAPTER = 'userauth.adapter.CustomAccountAdapter'

SOCIALACCOUNT_ADAPTER = 'userauth.adapter.CustomSocialAccountAdapter'

ROOT_URLCONF = 'config.urls'

TEMPLATES = [

{

'BACKEND': 'django.template.backends.django.DjangoTemplates',

'DIRS': ['templates'],

'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',

'events.context_processor.custom_context',

],

},

},

]

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'),

}

}

POSTGRES_LOCALLY = False

if ENVIRONMENT == 'production' or POSTGRES_LOCALLY == True:

DATABASES['default'] = dj_database_url.parse(os.getenv('DBURL'))

AUTHENTICATION_BACKENDS = [

'django.contrib.auth.backends.ModelBackend',

'allauth.account.auth_backends.AuthenticationBackend',

]

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',

},

]

EMAIL_BACKEND = os.getenv('EBACKEND')

EMAIL_HOST = os.getenv('EHOST')

EMAIL_HOST_USER = os.getenv('EHOSTUSER')

EMAIL_HOST_PASSWORD = os.getenv('EHOSTPASS')

EMAIL_PORT = 587

EMAIL_USE_TLS = bool(os.getenv('ETLS'))

DEFAULT_FROM_EMAIL = os.getenv('DEFAULTFROMEMAIL')

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

STATIC_PROJECT_DIR = os.path.join(BASE_DIR, 'static')

STYLES_DIR = os.path.join(STATIC_PROJECT_DIR, 'styles')

STATICFILES_DIRS = [

STATIC_PROJECT_DIR,

STYLES_DIR,

]

MEDIA_URL = '/media/'

MEDIA_ROOT = (os.path.join(BASE_DIR, 'media/'))

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

LOGIN_REDIRECT_URL = '/'

LOGOUT_REDIRECT_URL = '/'

View Deploy details

> ⓘ 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?


davidpal3c
TRIALOP

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

Are you sure your Procfile is named "Procfile" with a capital P.


davidpal3c
TRIALOP

2 years ago

Yes


davidpal3c
TRIALOP

2 years ago

all solved now, thank you so much for your help !


2 years ago

What was the issue?


Welcome!

Sign in to your Railway account to join the conversation.

Loading...