Hey everyone, I have brought up this issue before, and I was able to fix a few things but I am still having a lot of problems. I have a model with a filefield, and i was testing it with the development server and it worked perfectly. When I tried to copy it into the working server is when I started having problems. The following is the model:
class BulkDataRegFile(models.Model): """DataProviders can register their data sets in large amounts without having to enter the information into the same form several times. This class takes a file field that uploads the file to the system server and then reads the file and places the data into the database for use by others """ user = models.ForeignKey(User, blank = False) domain = models.ForeignKey(DataDomain, blank = False) bulk = models.FileField(upload_to = 'bulk/', unique = True) def __str__(self): return self.bulk def save(self): super(BulkDataRegFile, self).save() import ConfigParser config = ConfigParser.ConfigParser() file = get_bulk_filename() config.readfp(open(file)) sec = config.sections() for i in sec: set_name = i it = config.items(i) for k in it: tag = k[0] if tag == 'url': url = k[1] elif tag == 'type': type1 = k[1] elif tag == 'end_date': end = k[1] elif tag == 'start_date': start = k[1] elif tag == 'metadata': meta = k[1] if type1 == 'timeseries': type1 = 0 else: type1 = 1 univ = '%s.%s' % (domain.get_udi_prefix(), set_name) b = DataSet(domain = self.domain, data_set_type = type1, udi = univ, start_time = start, end_time = end, metadata = meta, server_url = url,) b.save() class Admin: pass I updated the database to add the table and synced it. Now I go into the Admin and try to upload a file through the admin interface and I get the following error: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in get_response 74. response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/ decorators.py" in _checklogin 55. return view_func(request, *args, **kwargs) File "/usr/lib/python2.4/site-packages/django/views/decorators/ cache.py" in _wrapped_view_func 40. response = view_func(request, *args, **kwargs) File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/ main.py" in add_stage 257. new_object = manipulator.save(new_data) File "/usr/lib/python2.4/site-packages/django/db/models/ manipulators.py" in save 101. new_object.save() File "/opt/vidars/cns/vidars/models.py" in save 189. config.readfp(open(file)) IOError at /admin/vidars/bulkdataregfile/add/ [Errno 2] No such file or directory: '' I have no idea what to do from here, for some reason it wont actually save the file to the directory I specified if i configured it correctly, which i am still not sure about. MEDIA_ROOT = '/var/www/media/' MEDIA_URL = 'https://vidars.sr.unh.edu/media/' media is a symbolic link to the media file in my app which contains all the css and images, so the apache server is serving those. other than that i dont know what to do. I am wondering if it is at a django level because when i get the traceback it gives me the values of the variables being used and the field 'bulk' doesnt get an id like the following. auto_now_add False f <django.db.models.fields.FileField object at 0xa9aa268c> new_data <MultiValueDict: {'domain': ['5'], 'user_id': ['5'], 'bulk_file': [{'content': '[ac.brms]\ntype: timeseries\nurl: http://terra.sr.unh.edu/cgi-bin/dataserver.pl\nstart_date: 1997-08-27\nend_date: 200-12-18\nmetadata: These data have been scraped from the NASA/CDAWEB website:\n http://cdaweb.gsfc.nasa.gov/cdaweb/istp_public/\n They are only meant for internal use and VIDARS testing.\n Use at your own risk! Jimmy Raeder [EMAIL PROTECTED]: timeseries\nurl: http://terra.sr.unh.edu/cgi-bin/dataserver.pl\nstart_date: 1997-08-27\nend_date: 2004-12-31\nmetadata: These data have been scraped from the NASA/\n\t CDAWEB website:http://cdaweb.gsfc.nasa.gov/ \n\t cdaweb/istp_public/ \n They are only meant for internal use and VIDARS\n\t testing.Use at your own risk! Jimmy Raeder\n\n[ac.bygse] \ntype: timeseries\nurl: http://terra.sr.unh.edu/cgi-bin/dataserver.pl\nstart_date: 1997-08-27\nend_date: 2004-12-31\nmetadata: These data have been scraped from the NASA/\n\t CDAWEB website:http://cdaweb.gsfc.nasa.gov/ \n\t cdaweb/istp_public/ \n They are only meant for internal use and VIDARS\n\t testing.Use at your own risk! Jimmy Raeder\n\n\n[ac.bzgse] \ntype: timeseries\nurl: http://terra.sr.unh.edu/cgi-bin/dataserver.pl\nstart_date: 1997-08-27\nend_date: 2004-12-31\nmetadata: These data have been scraped from the NASA/\n\t CDAWEB website:http://cdaweb.gsfc.nasa.gov/ \n\t cdaweb/istp_public/ \n They are only meant for internal use and VIDARS\n\t testing.Use at your own risk! Jimmy Raeder \n\n[ac.he-rat] \ntype: timeseries\nurl: http://terra.sr.unh.edu/cgi-bin/dataserver.pl\nstart_date: 1998-11-01\nend_date: 2000-07-31\nmetadata: These data have been scraped from the NASA/\n\t CDAWEB website:http://cdaweb.gsfc.nasa.gov/ \n\t cdaweb/istp_public/ \n They are only meant for internal use and VIDARS\n\t testing.Use at your own risk! Jimmy Raeder \n', 'content- type': 'application/octet-stream', 'filename': 'testfile.ini'}], 'bulk': [''], 'user': ['5'], 'domain_id': ['5']}> new_object <BulkDataRegFile: > param '' params {'bulk': '', 'user_id': '5', 'id': None, 'domain_id': '5'} self <django.db.models.manipulators.AddManipulator object at 0xa99fbf0c> this shows me that it grabs the value of the file i uploaded but its not saving it to the database correctly and its not actually saving the contents of the file to the server . so if any one has any suggestions i would greatly appreciate it becuase this is a huge wall that i have hit and can't seem to get past it no matter what i research or try. Thanks for your time! Jacob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---