8 months ago
I am deploying a Django site on railway. So far so good, it's using the Nixpacks and building everything in my requirements.txt file, and launching Django correctly.
My problem: I need to use a library that's implemented in .Net, so my deployment requires both .Net 6.0 SDK, and python, at the same time.
I added a .csproj file, so that the build would install the .Net SDK, but now... it no longer installs python! How do I get both python and .Net SDK included at the same time?
Here's my dummy foolrailway.csproj file:
```
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>
```
and here's my railway.json.
```
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"startCommand": "python manage.py collectstatic && gunicorn www.wsgi",
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
```
Pinned Solution
8 months ago
Solved, two things required for this to work:
As described in the Nixpacks docs, I added a
nixpacks.tomlwith[phases.setup] nixPkgs = ['...', 'dotnet-sdk_6'].Instead of importing
import ironxl(the official package), I looked at their__init__.py, extracted the parts I need, and wrote my own wrapper for the .Net libraries. I will be posting a patch to the IronXL folks to get their official python module fixed for Linux.
4 Replies
8 months ago
Hey, can you try adding the Python and C# providers directly by modifying your railway.json?
{
"build": {
"builder": "NIXPACKS",
"nixpacksPlan": {
"providers": [
"python",
"c#"
]
}
}
}
8 months ago
I ended up adding a nixpacks.toml , and got that working there. Now I have a harder problem to solve... the python library I'm using, IronXL, seems to think .net is not installed, even though it is. Looking at the python packages source code, it's non-Windows code seems a little flaky...
I may have to switch to Docker instead of Nixpacks to sort this out, thank you anyway.
8 months ago
Yeah this is lame. Installing the package places the dll in /opt/venv/IronXLNet/IronXL.dll , but when I import the package, its __init__.py is looking inside of /opt/venv/../../.. . I guess it's just a bug in their package and nobody tested that it actually works in Linux. sigh. I guess I need to fork it...
8 months ago
Solved, two things required for this to work:
As described in the Nixpacks docs, I added a
nixpacks.tomlwith[phases.setup] nixPkgs = ['...', 'dotnet-sdk_6'].Instead of importing
import ironxl(the official package), I looked at their__init__.py, extracted the parts I need, and wrote my own wrapper for the .Net libraries. I will be posting a patch to the IronXL folks to get their official python module fixed for Linux.
Status changed to Solved chandrika • 8 months ago