Forums

Django, uploading static files, wrong path

Hello everyone, I am strugging with image saving from admin panel. In my local env everything works fine and uploaded images land in static folder, but on pythonanewhere they are saved in different loaction. That's my code and configs:

models.py

def generate_filename(self, filename):
    url = "static/galeria/rosliny/%d/%s" % (int(self.nazwa_polska.id_rosliny), filename)
    return url

image = models.ImageField(max_length=255, upload_to=generate_filename)

my web urls configuartion for static:

/static/     -  /home/pepikfest/zielnik_karpacki/static

but files are saving into /home/pepikfes/static/, they misses zielnik_karpacki foler, what I doing wrong? Please help :/

What do you have MEDIA_ROOT set to in your settings.py file?