Wednesday, October 2, 2024

Re: Django CSS Not Loaded in Vercel app

you can look at my urls.py and add the missing path to yours.
https://github.com/nbesoro/techyao/blob/main/core/urls.py#L27 

Le mer. 2 oct. 2024 à 14:06, Sahil Gupta <gguptassahil@gmail.com> a écrit :
 
after deploying it show css files and images file on vercel but it not appearedon the web app. 
 

vercel.json


settings.py 
only pasting the relevant changes for vercel
ALLOWED_HOSTS = ['.vercel.app', '.now.sh', '127.0.0.1', 'localhost']

STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_build')

build_files.sh
#!/bin/bash
echo "BUILD START"
python3 -m pip install --upgrade pip  # Ensure the latest pip version
python3 -m pip install -r requirements.txt  # Install all dependencies
python3 manage.py collectstatic --noinput --clear  # Collect static files
echo "BUILD END"

my django web app is running fine on local sever with css and images, but on vercel it shows only HTML, no css and no images. my vercel app link : https://portfolio-bqgy3ipxf-sahilgupta245s-projects.vercel.app/ github repository link : https://github.com/sahilgupta245/portfolio

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d46b2ce2-554f-4ceb-ad4e-96cbdaf0e2a6n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOtSHp-Ou_XstcWD3EE13j5uEFAvQzdT%3D9PG8xYagmBryNoPuQ%40mail.gmail.com.

Replay your Django app

https://retracesoftware.com allows you to record and replay your Django app. It is a massive time saver, enabling you to investigate bugs and flaky tests with perfect reproducibility.

We have an initial user group. Members get a free for life licence in return for feedback. We have a couple of spaces that have come up. Let me know if you are interested in joining, and we can get you set up (it is very easy, with 5-10 min onboarding).


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cedcc7e3-7f13-48ec-8db4-ebf661170910n%40googlegroups.com.

Tuesday, October 1, 2024

Django CSS Not Loaded in Vercel app

source.png 
after deploying it show css files and images file on vercel but it not appearedon the web app. 
webapp.png 

vercel.json
vercel.png

settings.py 
only pasting the relevant changes for vercel
ALLOWED_HOSTS = ['.vercel.app', '.now.sh', '127.0.0.1', 'localhost']

STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_build')

build_files.sh
#!/bin/bash
echo "BUILD START"
python3 -m pip install --upgrade pip  # Ensure the latest pip version
python3 -m pip install -r requirements.txt  # Install all dependencies
python3 manage.py collectstatic --noinput --clear  # Collect static files
echo "BUILD END"

my django web app is running fine on local sever with css and images, but on vercel it shows only HTML, no css and no images. my vercel app link : https://portfolio-bqgy3ipxf-sahilgupta245s-projects.vercel.app/ github repository link : https://github.com/sahilgupta245/portfolio

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d46b2ce2-554f-4ceb-ad4e-96cbdaf0e2a6n%40googlegroups.com.