HOW TO SOLVE STATIC FILES NOT SHOWING: Step 1:run pip install whitenoise step 2: run pip freeze > requirements.txt step 3: In middleware in your settings.py file, add this line below the first middle: "whitenoise.middleware.WhiteNoiseMiddleware", step 4: Configure static files. make sure you have something like this: STATIC_URL = '/static/' STATIC_ROOT = BASE_DIR / "staticfiles" STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ] step 5: Add this line to your settings.py file: STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" step 6: run python manage.py collectstatic step 7: push to github and try to redeploy That should solve the issue
@@the_proton_guy I fix the 500 error by putting this object as in the white noise docs instead that storage: STORAGES = { "staticfiles": { "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage", }, } anyway it doesn't show static files but only the components without styles. To activate styling you have to use the debug to True, but it s not recommended to use debug in production !
bro please im getting this error, ive tried several times but still: You reached the start of the range → Nov 11, 2024 8:06 PM install │ python -m venv --copies /opt/venv && . /opt/venv/bin/activate ║
║──────────────────────────────────────────────────────────────────────────────║ ║ start │ Error: No start command could be found i have the requirements.txt, and this is also my procfile :web: gunicorn 'flaskblog:create_app()' please ive tried several times and it's not working, please i would really appreciate your help
For this, you will need to go to your app on heroku. Next, you'll need to click the button labelled more on the top right of your screen. Next select run console. After that, a window should pop up where you can run commands. So just run python manage.py createsuperuser and all should work
No, what you need to do is add a database to your project on railway. Luckily, they have a PostgresSQL database you can use as an add-on to your project. this link below will take you to an article that will teach you how to do this: dev.to/mr_destructive/django-postgresql-deployment-on-railway-app-d54 After that, you will be able to run createsuperuser and have the user saved in the PostgresSQL database
You need to checkout csrf trusted origins. Cjeck this stack overflow question stackoverflow.com/questions/38841109/csrf-validation-does-not-work-on-django-using-https
how to i access the python installed for the application i dont see any terminal option in the site and i did install railway by scoop and using shell but i cant acess the python installed for the application pls help
Could someone help me clarify a question? I've successfully deployed my Django App on Railway using SQLite. Now, let's say a user makes a post request that updates the database. Will these changes be reflected in my GitHub repository? In other words, if I make a new push to my GitHub repo and Railway re-deploys, will it recognize that the existing database file is already up to date and avoid replacing it with the outdated one from GitHub?
No, the data will not be saved on github. If railway redeploys, it will overwrite the existing database with the old one from github. If you wish to remove this issue, connect to an external database. You can create and connect to a postgresql database on Railway
@@the_proton_guy I see, Thank you very much! Can I somehow download that database on railway that was assigned to me so that I can manually push it to github?
Hmm, I am not so sure about that, but for future purposes, if you want to export your database for backup purposes, look into ghe django import export library
thanks for your video, I have troubles with databases, deploy fails at Collecting mysqlclient==2.1.1 and then at Collecting psycopg for postgress database, would you help to understand how to fix that dependencies
Hi, okay. Why do you have mysqlclient and a Postgresql database? A fix for the psycopg2 is: Instead of using psycopg2, replace it with psycopg2-binary. So pip install psycopg2-binary. After that, run pip freeze > requirements.txt to save the new library to the file Then, go to the requirements.txt file and locate where psycopg2 is and remove it. Push to github and your railway app should automatically start deployment
@@the_proton_guy thanks, I tested first with mysql but didn't work, for posgress I tested with psycopg2-binary but the error continues I was checking in some post and they says that is a problem of the SO disfribution, maybe I will try with aws maybe that can help me to deploy, heroku is not more free
@@the_proton_guy Hey, I solved that error by saving the requirement.txt file and shifting it into UTF-8 from UTF-16. but now I'm stuck on modules. when installing the modules, an error comes that "Could not find a version that satisfies the requirement pywin32==304" Docker build failed
"Pywin32==304". Isn't it suposed to be something like pywin32==3.0.4 Check your requirements.txt and if pywin32 is there, make a change to 3.0.4 and try again to see if that fixes the error
You can create a postgress database on Railway as a project and connect to it from your django project. That way, your Web app and database are in the same place
#11 11.83 creating build/lib.linux-x86_64-cpython-311/cairo #11 11.83 copying cairo/__init__.py -> build/lib.linux-x86_64-cpython-311/cairo #11 11.83 copying cairo/__init__.pyi -> build/lib.linux-x86_64-cpython-311/cairo #11 11.83 copying cairo/py.typed -> build/lib.linux-x86_64-cpython-311/cairo #11 11.83 running build_ext #11 11.83 Package cairo was not found in the pkg-config search path. #11 11.83 Perhaps you should add the directory containing `cairo.pc' #11 11.83 to the PKG_CONFIG_PATH environment variable #11 11.83 No package 'cairo' found #11 11.83 Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1. #11 11.83 [end of output] #11 11.83 #11 11.83 note: This error originates from a subprocess, and is likely not a problem with pip. #11 11.83 ERROR: Failed building wheel for pycairo #11 11.83 Failed to build pycairo #11 11.83 ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects #11 11.85 #11 11.85 [notice] A new release of pip available: 22.3.1 -> 23.1.2 #11 11.85 [notice] To update, run: pip install --upgrade pip
#11 ERROR: process "/bin/bash -ol pipefail -c python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt" did not complete successfully: exit code: 1 ----- > [stage-0 7/8] RUN --mount=type=cache,id=s/12ad632d-3245-4503-b551-fa89e82b6a0e-/root/cache/pip,target=/root/.cache/pip python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt: #11 11.83 Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1. #11 11.83 [end of output] #11 11.83 #11 11.83 note: This error originates from a subprocess, and is likely not a problem with pip. #11 11.83 ERROR: Failed building wheel for pycairo #11 11.83 Failed to build pycairo #11 11.83 ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects #11 11.85 #11 11.85 [notice] A new release of pip available: 22.3.1 -> 23.1.2 #11 11.85 [notice] To update, run: pip install --upgrade pip -----
@@the_proton_guy Are u genius? I saw a guy asked you before , u told him just check, ant it is worked. Now I made liitle change(exactle removed psycop2 and used binary one) and it works. THANK YOUUUUUUUUUUUUUU
Hey, I am getting this error can you help me Building wheels for collected packages: twisted-iocpsupport #11 22.64 Building wheel for twisted-iocpsupport (pyproject.toml): started
#11 23.27 Building wheel for twisted-iocpsupport (pyproject.toml): finished with status 'error'
#11 23.28 error: subprocess-exited-with-error #11 23.28 #11 23.28 × Building wheel for twisted-iocpsupport (pyproject.toml) did not run successfully. #11 23.28 │ exit code: 1 #11 23.28 ╰─> [13 lines of output] #11 23.28 running bdist_wheel #11 23.28 running build #11 23.28 running build_ext #11 23.28 building 'twisted_iocpsupport.iocpsupport' extension #11 23.28 creating build #11 23.28 creating build/temp.linux-x86_64-cpython-310 #11 23.28 creating build/temp.linux-x86_64-cpython-310/twisted_iocpsupport #11 23.28 gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/nix/store/vamwsqfpvgfwnc7ksa8k4aa52my5r1bq-libxcrypt-4.4.33/include -fPIC -Itwisted_iocpsupport -I/opt/venv/include -I/nix/store/al6g1zbk8li6p8mcyp0h60d08jaahf8c-python3-3.10.9/include/python3.10 -c twisted_iocpsupport/iocpsupport.c -o build/temp.linux-x86_64-cpython-310/twisted_iocpsupport/iocpsupport.o #11 23.28 twisted_iocpsupport/iocpsupport.c:767:10: fatal error: io.h: No such file or directory #11 23.28 767 | #include "io.h" #11 23.28 | ^~~~~~
Hey, Firts of all great video! I have an error that I can not fix because I didnt find any information about it, I'll paste it here: ============== Using Nixpacks ============== Nixpacks build failed Error: stream did not contain valid UTF-8 Maybe You can help me with that!
Hello, I'm from Brazil. Thanks for the video. In deploy I have the following error message: do you know what it could be? usage: gunicorn [OPTIONS] [APP_MODULE] gunicorn: error: argument --error-logfile/--log-file: expected one argument
Hello how are you? thanks a lot for your video. I have multiples troubles while deploy to railway. The first is that I have tailwind installed on my django app and it dont load when I deploy on railway and the other problem is that I have this on my deploy logs: [2022-09-21 08:05:02 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:291) [2022-09-21 08:05:02 +0000] [291] [INFO] Worker exiting (pid: 291) [2022-09-21 08:05:02 +0000] [292] [INFO] Booting worker with pid: 292 /opt/venv/lib/python3.10/site-packages/environ/environ.py:648: UserWarning: Error reading /app/.env - if you're not configuring your environment separately, check this. warnings.warn(
@@the_proton_guy images are loaded but not the css, I have : Not Found: /static/css/dist/styles.css in my deploy logs. how can i check on railway cli if i use virtual env? because on local all is working properly with my virtucal env
Ok so i found a solution. Step 1: pip install white noise step 2: pip freeze > requirements.txt step 3: In middleware in your settings.py file, add this line below the first middle: "whitenoise.middleware.WhiteNoiseMiddleware", step 4: Configure static files. make sure you have something like this: STATIC_URL = '/static/' STATIC_ROOT = BASE_DIR / "staticfiles" STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ] step 5: Add this line to your settings.py file: STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" step 6: run python manage.py collect static step 7: push to github and try to redeploy That should solve the issue
HOW TO SOLVE STATIC FILES NOT SHOWING:
Step 1:run pip install whitenoise
step 2: run pip freeze > requirements.txt
step 3: In middleware in your settings.py file, add this line below the first middle:
"whitenoise.middleware.WhiteNoiseMiddleware",
step 4: Configure static files. make sure you have something like this:
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / "staticfiles"
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
step 5: Add this line to your settings.py file:
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
step 6: run python manage.py collectstatic
step 7: push to github and try to redeploy
That should solve the issue
it throws error 500 in production
Can you check the logs? To see of there's any error
@@the_proton_guy I fix the 500 error by putting this object as in the white noise docs instead that storage:
STORAGES = {
"staticfiles": {
"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
},
}
anyway it doesn't show static files but only the components without styles. To activate styling you have to use the debug to True, but it s not recommended to use debug in production !
Really appreciate your effort,thanks very much 🙏
You are welcome 🥳
What is your 'Start Command from Deploy' in settings on railway?
gunicorn ProjectName.wsgi --log-file -
Hello,I have this problem
Nixpacks build failed
Error: Error reading requirements.txt
Caused by:
stream did not contain valid UTF-8
I have the same problem
Can you kindly shed more light on this error
@@the_proton_guy Getting error can you help me??
Nixpacks build failed
Nixpacks was unable to generate a build plan for this app.
This was really helpful, thanks.
You are welcome 🥳
bro please im getting this error, ive tried several times but still:
You reached the start of the range → Nov 11, 2024 8:06 PM
install │ python -m venv --copies /opt/venv && . /opt/venv/bin/activate ║
║──────────────────────────────────────────────────────────────────────────────║
║ start │
Error: No start command could be found
i have the requirements.txt, and this is also my procfile :web: gunicorn 'flaskblog:create_app()'
please ive tried several times and it's not working, please i would really appreciate your help
Hello , how do I add superuser to my django app on heroku
For this, you will need to go to your app on heroku. Next, you'll need to click the button labelled more on the top right of your screen. Next select run console. After that, a window should pop up where you can run commands. So just run python manage.py createsuperuser and all should work
I never deployed the project to heroku . I only deployed it railways. Does it mean I have to again deploy it to heroku for it to create superuser
No, what you need to do is add a database to your project on railway. Luckily, they have a PostgresSQL database you can use as an add-on to your project. this link below will take you to an article that will teach you how to do this:
dev.to/mr_destructive/django-postgresql-deployment-on-railway-app-d54
After that, you will be able to run createsuperuser and have the user saved in the PostgresSQL database
Is your app correctly listening to $PORT.
How to solve this? I even added PORT with the value of 4000 or 8000 it still won't work.
Thanks for the tutorial! it really clear and helpful
You are welcome 🥳🥳
does it support python 3.11 and 3.11.1, and how to upload it without error docker build failed,nixpacks build failed
Yes I think it does. Let me look jnto the error and see what fix I find
how to save user upload files in railway?
You would need a database for that
How to solve the CSRF issues? I cannot now access to the admin page.
Error: Forbiden(403) CSRF verification failed. Request aborted.
You need to checkout csrf trusted origins. Cjeck this stack overflow question stackoverflow.com/questions/38841109/csrf-validation-does-not-work-on-django-using-https
Hello am getting not found after a successful build. How do I solve it
A 404 error?
how to i access the python installed for the application i dont see any terminal option in the site and i did install railway by scoop and using shell but i cant acess the python installed for the application pls help
Umm, are you trying to access your app on Railway through your terminal?
Yep I would like to have direct access to the installed packages in the env
Hi, sorry for replying late. You can access the cli through railway cli. Visit the link below to learn more about it:
docs.railway.app/develop/cli
Error: No start command could be found
it's showing me this error
Can you give me more details ? Like maybe copy and past the errors so I can see
Could someone help me clarify a question? I've successfully deployed my Django App on Railway using SQLite. Now, let's say a user makes a post request that updates the database. Will these changes be reflected in my GitHub repository? In other words, if I make a new push to my GitHub repo and Railway re-deploys, will it recognize that the existing database file is already up to date and avoid replacing it with the outdated one from GitHub?
No, the data will not be saved on github. If railway redeploys, it will overwrite the existing database with the old one from github. If you wish to remove this issue, connect to an external database. You can create and connect to a postgresql database on Railway
@@the_proton_guy I see, Thank you very much! Can I somehow download that database on railway that was assigned to me so that I can manually push it to github?
Hmm, I am not so sure about that, but for future purposes, if you want to export your database for backup purposes, look into ghe django import export library
thanks for your video, I have troubles with databases, deploy fails at Collecting mysqlclient==2.1.1 and then at Collecting psycopg for postgress database, would you help to understand how to fix that dependencies
Hi, okay. Why do you have mysqlclient and a Postgresql database?
A fix for the psycopg2 is:
Instead of using psycopg2, replace it with psycopg2-binary.
So pip install psycopg2-binary.
After that, run pip freeze > requirements.txt to save the new library to the file
Then, go to the requirements.txt file and locate where psycopg2 is and remove it.
Push to github and your railway app should automatically start deployment
@@the_proton_guy thanks, I tested first with mysql but didn't work, for posgress I tested with psycopg2-binary but the error continues I was checking in some post and they says that is a problem of the SO disfribution, maybe I will try with aws maybe that can help me to deploy, heroku is not more free
Did you remove psycopg2 from the requirements.txt file?
thank you for the tuto i only have one question what about the media file how to configure and server them via railway ty
Hello, you will need to find a place to store your media files, like an s3 bucket or cdn like cloudinary, as it is best practice
@@the_proton_guy thannk you
Happy to help 🥳
@@the_proton_guy im just learning so do you have any free suggestions ?
@devilmeliodas9091 yes. I would highly recommend cloudinary, although you can also look into Amazon s3 buckets
Hello sir, the build works but I am getting an error ModuleNotFoundError: No module named 'tdl' when I deploy. kindly advise, thanks
Hey, in your procfile, replace tdl with your django project name and redeploy
@THE PROTON GUY I'm stuck at one error :
Nixpacks build failed
Error: stream did not contain valid UTF-8
please reply me asap
Can I see your repository
@@the_proton_guy Hey, I solved that error by saving the requirement.txt file and shifting it into UTF-8 from UTF-16. but now I'm stuck on modules. when installing the modules, an error comes that "Could not find a version that satisfies the requirement pywin32==304" Docker build failed
@@the_proton_guy Is there any way to deploy Django App on Railway Manually??
"Pywin32==304". Isn't it suposed to be something like pywin32==3.0.4
Check your requirements.txt and if pywin32 is there, make a change to 3.0.4 and try again to see if that fixes the error
what can i do if i have postgreSQL database with my project
Is your postgresql online?
@@the_proton_guy no, it's local.
You can create a postgress database on Railway as a project and connect to it from your django project. That way, your Web app and database are in the same place
@@the_proton_guy thank you
You are welcome
Hello please I'm having an error "Error Docker build"
please help me fix that
thank you
Hey, can you check the deploy logs to see what the error is?
How can I change the Branch ? by default its using the master branch, I want to change it.
Hii, this can be done from the settings tab of your project in railway
Thanks!
You are welcome!
Hello, how do you do?
I am getting the following error when deploying my Django project:
Dockerfile:21
-------------------
19 | RUN printf '
PATH=/opt/venv/bin:$PATH' >> /root/.profile
20 | COPY . /app/.
21 | >>> RUN --mount=type=cache,id=s/12ad632d-3245-4503-b551-fa89e82b6a0e-/root/cache/pip,target=/root/.cache/pip python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt
22 |
23 |
-------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt" did not complete successfully: exit code: 1
Error: Docker build failed
Please help
Hey. Can you check the logs to see if any library from the requirements file could not install properly
@@the_proton_guy thank you so much for responding.
Which logs, the deploy?
Yes, the deploy logs
@@the_proton_guy Here's the full log:
#11 11.83 creating build/lib.linux-x86_64-cpython-311/cairo
#11 11.83 copying cairo/__init__.py -> build/lib.linux-x86_64-cpython-311/cairo
#11 11.83 copying cairo/__init__.pyi -> build/lib.linux-x86_64-cpython-311/cairo
#11 11.83 copying cairo/py.typed -> build/lib.linux-x86_64-cpython-311/cairo
#11 11.83 running build_ext
#11 11.83 Package cairo was not found in the pkg-config search path.
#11 11.83 Perhaps you should add the directory containing `cairo.pc'
#11 11.83 to the PKG_CONFIG_PATH environment variable
#11 11.83 No package 'cairo' found
#11 11.83 Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
#11 11.83 [end of output]
#11 11.83
#11 11.83 note: This error originates from a subprocess, and is likely not a problem with pip.
#11 11.83 ERROR: Failed building wheel for pycairo
#11 11.83 Failed to build pycairo
#11 11.83 ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects
#11 11.85
#11 11.85 [notice] A new release of pip available: 22.3.1 -> 23.1.2
#11 11.85 [notice] To update, run: pip install --upgrade pip
#11 ERROR: process "/bin/bash -ol pipefail -c python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt" did not complete successfully: exit code: 1
-----
> [stage-0 7/8] RUN --mount=type=cache,id=s/12ad632d-3245-4503-b551-fa89e82b6a0e-/root/cache/pip,target=/root/.cache/pip python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt:
#11 11.83 Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
#11 11.83 [end of output]
#11 11.83
#11 11.83 note: This error originates from a subprocess, and is likely not a problem with pip.
#11 11.83 ERROR: Failed building wheel for pycairo
#11 11.83 Failed to build pycairo
#11 11.83 ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects
#11 11.85
#11 11.85 [notice] A new release of pip available: 22.3.1 -> 23.1.2
#11 11.85 [notice] To update, run: pip install --upgrade pip
-----
Dockerfile:21
-------------------
19 | RUN printf '
PATH=/opt/venv/bin:$PATH' >> /root/.profile
20 | COPY . /app/.
21 | >>> RUN --mount=type=cache,id=s/12ad632d-3245-4503-b551-fa89e82b6a0e-/root/cache/pip,target=/root/.cache/pip python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt
22 |
23 |
-------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt" did not complete successfully: exit code: 1
Error: Docker build failed
hi, i am sorry. just seeing this. The error seems to be pointing to a library or package called cairo
Great video. But it does not describe what to do with environment variables.Where did you place your secret key? Railway? Github?
I put them into railway and it goes
how to solve this error:
Is your app listening correctly on $PORT?
Ummmm, did you configure allowed hosts well
@@the_proton_guy where do I configure, in VS CODE or in Railway?
Vs code, in your settings.py
Best video
Thank youuu
Which database you used? The database is giving me a lot of issue
Sqlite db
after deploy I got server error 500
Um, okay. Can you check the deploy logs to see what the error is?
@@the_proton_guy Are u genius? I saw a guy asked you before , u told him just check, ant it is worked. Now I made liitle change(exactle removed psycop2 and used binary one) and it works. THANK YOUUUUUUUUUUUUUU
You are welcomeeee😹😹a sub to the channel will be helpfulllll🥺🥺
Its the same thing as heroku or is it better than heroku?
I wouldn't say better, but it's good
Hey, I am getting this error can you help me
Building wheels for collected packages: twisted-iocpsupport
#11 22.64 Building wheel for twisted-iocpsupport (pyproject.toml): started
#11 23.27 Building wheel for twisted-iocpsupport (pyproject.toml): finished with status 'error'
#11 23.28 error: subprocess-exited-with-error
#11 23.28
#11 23.28 × Building wheel for twisted-iocpsupport (pyproject.toml) did not run successfully.
#11 23.28 │ exit code: 1
#11 23.28 ╰─> [13 lines of output]
#11 23.28 running bdist_wheel
#11 23.28 running build
#11 23.28 running build_ext
#11 23.28 building 'twisted_iocpsupport.iocpsupport' extension
#11 23.28 creating build
#11 23.28 creating build/temp.linux-x86_64-cpython-310
#11 23.28 creating build/temp.linux-x86_64-cpython-310/twisted_iocpsupport
#11 23.28 gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/nix/store/vamwsqfpvgfwnc7ksa8k4aa52my5r1bq-libxcrypt-4.4.33/include -fPIC -Itwisted_iocpsupport -I/opt/venv/include -I/nix/store/al6g1zbk8li6p8mcyp0h60d08jaahf8c-python3-3.10.9/include/python3.10 -c twisted_iocpsupport/iocpsupport.c -o build/temp.linux-x86_64-cpython-310/twisted_iocpsupport/iocpsupport.o
#11 23.28 twisted_iocpsupport/iocpsupport.c:767:10: fatal error: io.h: No such file or directory
#11 23.28 767 | #include "io.h"
#11 23.28 | ^~~~~~
Thanks❤
You are welcome bro
Hey, Firts of all great video!
I have an error that I can not fix because I didnt find any information about it, I'll paste it here:
==============
Using Nixpacks
==============
Nixpacks build failed
Error: stream did not contain valid UTF-8
Maybe You can help me with that!
Ok, I'll look into it
Hello, I'm from Brazil. Thanks for the video. In deploy I have the following error message: do you know what it could be?
usage: gunicorn [OPTIONS] [APP_MODULE]
gunicorn: error: argument --error-logfile/--log-file: expected one argument
Hiii, are you sure you configure your Procfile properly
Hello how are you? thanks a lot for your video. I have multiples troubles while deploy to railway. The first is that I have tailwind installed on my django app and it dont load when I deploy on railway and the other problem is that I have this on my deploy logs: [2022-09-21 08:05:02 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:291)
[2022-09-21 08:05:02 +0000] [291] [INFO] Worker exiting (pid: 291)
[2022-09-21 08:05:02 +0000] [292] [INFO] Booting worker with pid: 292
/opt/venv/lib/python3.10/site-packages/environ/environ.py:648: UserWarning: Error reading /app/.env - if you're not configuring your environment separately, check this.
warnings.warn(
Hiiii, are you sure you configured your static files properly, and did you use a virtual environment?
@@the_proton_guy images are loaded but not the css, I have : Not Found: /static/css/dist/styles.css in my deploy logs.
how can i check on railway cli if i use virtual env? because on local all is working properly with my virtucal env
That's unusual, I don't think the railway has a cli you can interact with. Let me search for an answer and I'll get back. to you
@@the_proton_guy ok thanks a lot
Ok so i found a solution.
Step 1: pip install white noise
step 2: pip freeze > requirements.txt
step 3: In middleware in your settings.py file, add this line below the first middle:
"whitenoise.middleware.WhiteNoiseMiddleware",
step 4: Configure static files. make sure you have something like this:
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / "staticfiles"
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
step 5: Add this line to your settings.py file:
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
step 6: run python manage.py collect static
step 7: push to github and try to redeploy
That should solve the issue