What im trying to link in index.html
<link rel="stylesheet" href="{% static 'assets/css/main.css' %}"/>
and I have also done {%load static%}
my file structure is like this:
signup/static/assets/css/main.css
settings.py
STATIC_URL = 'signup/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
the error:
[29/Feb/2020 17:19:31] "POST /postsign/ HTTP/1.1" 200 3445
Not Found: /postsign/signup/static/assets/css/main.css
I cant understand where that /postsign/ is coming from
my urls.py is like this:
urlpatterns = [
path('admin/', admin.site.urls),
path('', views.signIn),
path('postsign/', views.postsign),
path('logout/', views.logout, name="log"),
path('signup/', views.signUp, name="signup"),
path('postsignup/', views.postsignup, name="postsignup"),
path('profile/', views.profile, name="prof"),
]
and the postsign method is:
def postsign(request):
email = request.POST.get('Email')
passw = request.POST.get("Password")
try:
user = authe.sign_in_with_email_and_password(email, passw)
except:
message = "Invalid Username or Password"
return render(request, "signin.html", {"messg": message})
print(user['idToken'])
session_id = user['idToken']
request.session['uid'] = str(session_id)
return render(request, "index.html")
Django ver 3.0.3 if that helps
Add the following to your URL patterns
from django.conf.urls.static import static
urlpatterns = [
...
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)`
向STATIC_URL
添加前导斜杠以避免静态 URL 是相对的:
STATIC_URL = '/signup/static/'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.