以这种方式更改时不起作用
path('<str:gameslug>/player/<str:slug>',player_detail,name="player_detail"), //don't work 404 not found error
更改前(正在工作)
path('player/<str:slug>',player_detail,name="player_detail"), // was working
models.py
image=models.ImageField(null=True,blank=True,upload_to='player')
错误:找不到页面(404)
答案 0 :(得分:0)
我将upload_to='player
更改为
现在更清楚
def create_path(instance, filename):
import os.path
return os.path.join(
instance.game.slug,
filename
)
现在的网址; media / gameslug / filepath