Unable to deploy django app

pixlfigma
HOBBY

a year ago

I am new to railway platform and I am trying to deploy a django app with mysql database but I keep getting this error.

> [stage-0 6/8] RUN --mount=type=cache,id=s/4db5f432-53fb-4701-8d1c-c36ed0c69363-/root/cache/pip,target=/root/.cache/pip python -m venv --copies /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt:

Aug 08 22:54:46

11.96

Aug 08 22:54:46

11.96 note: This error originates from a subprocess, and is likely not a problem with pip.

Aug 08 22:54:46

11.96 ERROR: Failed building wheel for mysqlclient

Aug 08 22:54:46

11.96 Building wheel for pyfcm (pyproject.toml): started

Aug 08 22:54:46

12.19 Building wheel for pyfcm (pyproject.toml): finished with status 'done'

Aug 08 22:54:46

12.19 Created wheel for pyfcm: filename=pyfcm-1.5.4-py3-none-any.whl size=15018 sha256=d37e0ef1673d9c3cd92a4a0288d61a28a7f113e95aefc6d531f32b75fcaa95b6

Aug 08 22:54:46

12.19 Stored in directory: /tmp/pip-ephem-wheel-cache-ewlis91g/wheels/6f/df/7a/33b199ccf43d3c4fda52c7ddec1995e8c26da1ac3fabe559eb

Aug 08 22:54:46

12.19 Successfully built pyfcm

Aug 08 22:54:46

12.19 Failed to build mysqlclient

Aug 08 22:54:46

12.19 ERROR: Could not build wheels for mysqlclient, which is required to install pyproject.toml-based projects

Aug 08 22:54:46

-----

Aug 08 22:54:46

Aug 08 22:54:46

2 warnings found (use --debug to expand):

Aug 08 22:54:46

Aug 08 22:54:46

UndefinedVar: Usage of undefined variable '$NIXPACKS_PATH' (line 18)

Aug 08 22:54:46

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 18)

After searching for a while I have added shell.nix file with the below contents

{ pkgs ? import <nixpkgs> {} }:

pkgs.stdenv.mkDerivation {

buildInputs = [

pkgs.mysql

pkgs.python3

pkgs.python3Packages.pip

];

# Optionally set up environment variables and build steps

shellHook = ''

export MYSQLCLIENT_CFLAGS="-I${pkgs.mysql.dev}/include"

export MYSQLCLIENT_LDFLAGS="-L${pkgs.mysql.dev}/lib -lmysqlclient"

'';

# Add more build instructions as needed

}

5 Replies

a year ago

After searching for a while I have added shell.nix file

Railway doesn't support shell.nix

Please use a pure python mysql client instead.


pixlfigma
HOBBY

a year ago

It worked!! thanks a lot. But one more thing where can I add python manage.py makemigrations and migrate commands before deployment or while deploying


a year ago

In your start command -

python manage.py migrate && [your current start command]

pixlfigma
HOBBY

a year ago

I want to create a logs directory save all kinds of logs in there, I have created a volume for that but unable to see what data is in that. I also want to know is my approach correct, if yes then how can I access the data in the volume I have created??


a year ago

You would want to print logs to stdout / stderr so you can view them in Railway's dashboard.