Deploying a django site that works in a devcontainer to Railway

Hi folks. I must confess to being a little new to this whole infra stuff. I know I can use templates from Railway but I have an existing Github repo with a Django project and I want to deploy it to Railway. It seems to build fine but will not deploy. It has a Docker file used for the devcontainer. What pre-requisites are there to get a Github Django project with Docker file to deploy to Railway?
27 Replies
Percy
Percy11mo ago
Project ID: 19eba2f9-bb53-431d-bdd9-186db8587fca
Tigershark
TigersharkOP11mo ago
19eba2f9-bb53-431d-bdd9-186db8587fca
Brody
Brody11mo ago
send the dockerfile? and the error you get when deploying
Tigershark
TigersharkOP11mo ago
Github repo is here
Tigershark
TigersharkOP11mo ago
GitHub
GitHub - jvanlint/codespace_test
Contribute to jvanlint/codespace_test development by creating an account on GitHub.
Tigershark
TigersharkOP11mo ago
thanks for the help....would love to know what I am not doing or doing wrong like I said....it works out of the box for a vscode devcontainer.
Brody
Brody11mo ago
vscode devcontainer
whats that?
Tigershark
TigersharkOP11mo ago
It is basically a docker image created by vscode that also lets you work in a vscode instance in the container https://code.visualstudio.com/docs/devcontainers/containers
Brody
Brody11mo ago
gotcha heres a better dockerfile
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.10-slim

# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

# Set the working directory
WORKDIR /app

# Copy in requirements.txt
COPY requirements.txt ./

# Install requirements
RUN pip install -r requirements.txt

# Copy in everything else
COPY . ./

# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD gunicorn --bind 0.0.0.0:${PORT-8000} optics.wsgi
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.10-slim

# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

# Set the working directory
WORKDIR /app

# Copy in requirements.txt
COPY requirements.txt ./

# Install requirements
RUN pip install -r requirements.txt

# Copy in everything else
COPY . ./

# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD gunicorn --bind 0.0.0.0:${PORT-8000} optics.wsgi
and then you want to bring the contents of the /optics folder out into the root of the repo
Tigershark
TigersharkOP11mo ago
ok...I'll give that a try. Thanks So I'm close....but still no cigar It seems to build, then deploy
Brody
Brody11mo ago
can you make the repo public again?
Tigershark
TigersharkOP11mo ago
This is deployment log DEBUG: True Operations to perform: Apply all migrations: admin, auth, contenttypes, sessions Running migrations: No migrations to apply. but this is the web browser when I go to the site
Tigershark
TigersharkOP11mo ago
No description
Tigershark
TigersharkOP11mo ago
It's like it's crashing but no indication in the logs it is
Brody
Brody11mo ago
public repo?
Tigershark
TigersharkOP11mo ago
let me get that to you 5 secs
Tigershark
TigersharkOP11mo ago
GitHub
GitHub - jvanlint/optics-railway
Contribute to jvanlint/optics-railway development by creating an account on GitHub.
Tigershark
TigersharkOP11mo ago
Obviously...if I remove the Docker file it will build and deploy fine using the railway.json
Brody
Brody11mo ago
and now build logs please
Brody
Brody11mo ago
well im stumped
Tigershark
TigersharkOP11mo ago
phew...glad its not just me thanks for trying
Want results from more Discord servers?
Add your server