Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7640577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:42:15+00:00 2026-05-31T08:42:15+00:00

my django application involves writing many data files to the server, part of my

  • 0

my django application involves writing many data files to the server, part of my user model class looks like this

class UserData(models.Model):
    email = models.EmailField()
    course_id = models.IntegerField()
    data = models.FileField(upload_to=make_user_data_path)

def make_user_data_path(instance, filename):
    username, domain = instance.email.split('@')
    name = username + '.bin'
    return os.path.normpath(os.path.join('gameservice', 'userdata', domain, name))

when running on my local server i get files saved as dummy_1.bin,dummy_2.bin,dummy_3.bin…etc in app/uploads/gameservice/userdata/sgi-singapore/ , it works fine

however when i deploy to heroku it doesnt seem to be able to retrieve the data.. im getting errors like this

media root = /app/uploads/

2012-03-13T05:15:28+00:00 app[web.1]: Traceback (most recent call last):
2012-03-13T05:15:28+00:00 app[web.1]: ERROR 2012-03-13 05:15:28,332 base 7 140089546524416 Internal Server Error: /gameservice/f1440caf4ae6d02b26c2387d14769af9/1/user_data
2012-03-13T05:15:28+00:00 app[web.1]:     response = callback(request, *callback_args, **callback_kwargs)
2012-03-13T05:15:28+00:00 app[web.1]:   File "/app/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
2012-03-13T05:15:28+00:00 app[web.1]:   File "/app/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 77, in wrapped_view
2012-03-13T05:15:28+00:00 app[web.1]:     return func(request, *args, **kwargs)
2012-03-13T05:15:28+00:00 app[web.1]:   File "/app/lib/python2.7/site-packages/django/views/decorators/http.py", line 41, in inner
2012-03-13T05:15:28+00:00 app[web.1]:     data = user_data.data.read()
2012-03-13T05:15:28+00:00 app[web.1]:   File "/app/lib/python2.7/site-packages/django/core/files/utils.py", line 16, in <lambda>
2012-03-13T05:15:28+00:00 app[web.1]:   File "/app/lib/python2.7/site-packages/django/core/files/storage.py", line 33, in open
2012-03-13T05:15:28+00:00 app[web.1]:     read = property(lambda self: self.file.read)
2012-03-13T05:15:28+00:00 app[web.1]:     return view_func(*args, **kwargs)
2012-03-13T05:15:28+00:00 app[web.1]:   File "/app/platformsite/gameservice/views.py", line 329, in user_data
2012-03-13T05:15:28+00:00 app[web.1]:     self._file = self.storage.open(self.name, 'rb')
2012-03-13T05:15:28+00:00 app[web.1]:   File "/app/lib/python2.7/site-packages/django/db/models/fields/files.py", line 46, in _get_file
2012-03-13T05:15:28+00:00 app[web.1]:     return self._open(name, mode)
2012-03-13T05:15:28+00:00 app[web.1]:   File "/app/lib/python2.7/site-packages/django/core/files/storage.py", line 156, in _open
2012-03-13T05:15:28+00:00 app[web.1]:     return File(open(self.path(name), mode))
2012-03-13T05:15:28+00:00 app[web.1]: IOError: [Errno 2] No such file or directory: u'/app/uploads/gameservice/userdata/sgi-singapore.com/krislee_6547.bin'

when i output the saving , it seems correct ,

2012-03-13T05:06:42+00:00 app[web.1]: ERROR 2012-03-13 05:06:42,263 views 7 140236532705024 userdata post
2012-03-13T05:06:42+00:00 app[web.1]: ERROR 2012-03-13 05:06:42,267 models 7 140236532705024 path saved = gameservice/userdata/sgi-singapore.com/krislee.bin
2012-03-13T05:06:42+00:00 heroku[router]: POST pure-fire-3271.herokuapp.com/gameservice/4ed1c492de837e0cc41596378ed0fb9f/1/user_data dyno=web.1 queue=0 wait=0ms service=451ms status=200 bytes=5
2012-03-13T05:06:43+00:00 app[web.1]: ERROR 2012-03-13 05:06:43,121 views 10 140236532705024 userdata post
2012-03-13T05:06:43+00:00 app[web.1]: ERROR 2012-03-13 05:06:43,127 models 10 140236532705024 path saved = gameservice/userdata/sgi-singapore.com/krislee.bin
2012-03-13T05:06:43+00:00 heroku[router]: POST pure-fire-3271.herokuapp.com/gameservice/4ed1c492de837e0cc41596378ed0fb9f/1/user_data dyno=web.1 queue=0 wait=0ms service=379ms status=200 bytes=5
2012-03-13T05:06:43+00:00 app[web.1]: ERROR 2012-03-13 05:06:43,826 views 8 140236532705024 userdata post
2012-03-13T05:06:43+00:00 app[web.1]: ERROR 2012-03-13 05:06:43,832 models 8 140236532705024 path saved = gameservice/userdata/sgi-singapore.com/krislee.bin
2012-03-13T05:06:44+00:00 heroku[router]: POST pure-fire-3271.herokuapp.com/gameservice/4ed1c492de837e0cc41596378ed0fb9f/1/user_data dyno=web.1 queue=0 wait=0ms service=381ms status=200 bytes=5
2012-03-13T05:06:44+00:00 app[web.1]: ERROR 2012-03-13 05:06:44,557 views 10 140236532705024 userdata post
2012-03-13T05:06:44+00:00 app[web.1]: ERROR 2012-03-13 05:06:44,562 models 10 140236532705024 path saved = gameservice/userdata/sgi-singapore.com/krislee.bin
2012-03-13T05:06:44+00:00 heroku[router]: POST pure-fire-3271.herokuapp.com/gameservice/4ed1c492de837e0cc41596378ed0fb9f/1/user_data dyno=web.1 queue=0 wait=0ms service=363ms status=200 bytes=5
2012-03-13T05:06:45+00:00 app[web.1]: ERROR 2012-03-13 05:06:45,263 views 10 140236532705024 userdata post
2012-03-13T05:06:45+00:00 app[web.1]: ERROR 2012-03-13 05:06:45,268 models 10 140236532705024 path saved = gameservice/userdata/sgi-singapore.com/krislee.bin
2012-03-13T05:06:45+00:00 heroku[router]: POST pure-fire-3271.herokuapp.com/gameservice/4ed1c492de837e0cc41596378ed0fb9f/1/user_data dyno=web.1 queue=0 wait=0ms service=367ms status=200 bytes=5
2012-03-13T05:06:46+00:00 heroku[router]: POST pure-fire-3271.herokuapp.com/gameservice/4ed1c492de837e0cc41596378ed0fb9f/1/save_score dyno=web.1 queue=0 wait=0ms service=154ms status=200 bytes=14

how do i fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T08:42:17+00:00Added an answer on May 31, 2026 at 8:42 am

    You can’t upload files on Heroku. Your app on heroku is packaged in a git slug so it can’t be modified at runtime. Use a s3 service with S3 file backend with something like django-storages http://django-storages.readthedocs.org/en/latest/index.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django application. One of my models looks like this: class MyModel(models.Model):
I have a blog-like application with stories and categories: class Category(models.Model): ... class Story(models.Model):
I have Django application with inline in place: class Account(models.Model): ContractNum = models.PositiveIntegerField(unique=True, blank=True,
In a django application I have the following model: class Appointment(models.Model): #some other fields
In Django application I have these models: class DLL(models.Model): prev = models.ForeignKey('self', related_name =
I am writing a Django application that has a model for People, and I
I am writing a Django application and using the built-in ORM. I would like
I have a django application, using the basic userprofile extension of django.contrib.auth.user model. I
I am writing a Django application, and I often use the Python backtick operator
I have a django application that creates xls and txt files. I'm trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.