Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
migrating django3.1 project in pythonanywhere error
enter image description here Hi, im trying to migrate a django3.1 project on python anywhere. it does not seem to work. thanks for the help in advance -
Django - Min/Max values not displaying on Index
I'm calculating the min and max values so I can display the spread of RRPs for a car model. Here I just have the min value, which is being calculated correctly but it will not display to the index file using the guidance I got from various examples/sites. Greatly appreciatte any help. Models.py class MotorMakes(models.Model): MotorMakeName = models.CharField(max_length=50, unique=True, default=False) def __str__(self): return self.MotorMakeName or '' def __unicode__(self): return u'%s' % (self.MotorMakeName) or '' class MotorModelsV2(models.Model): MotorMakeName = models.CharField(max_length=50, default=False,) MotorModelName = models.CharField(max_length=50, default=False,) Mkid = models.ForeignKey(MotorMakes,on_delete=models.CASCADE, default=False) Mlid = models.IntegerField(default=False, unique=True) MotorImage = models.ImageField(upload_to='Car_Pics', default=False,blank=True) def __str__(self): return self.MotorModelName or '' def __unicode__(self): return u'%s' % (self.MotorModelName) or '' class Meta: ordering = ('MotorMakeName',) class MotorDetail(models.Model): MotorMakeName = models.CharField(max_length=50, default=False,) MotorModelName = models.CharField(max_length=50, default=False,) title = models.CharField(max_length=100, default=False,) fuel = models.CharField(max_length=25, default=False,) body = models.CharField(max_length=25, default=False,) engine = models.CharField(max_length=5, default=False,) #Mkid = models.CharField(max_length=5, default=False,) #Mlid = models.CharField(max_length=5, default=False,) Mkid = models.ForeignKey(MotorMakes,on_delete=models.CASCADE, default=False, null=True) Mlid = models.ForeignKey(MotorModelsV2,on_delete=models.CASCADE, default=False, null=True) RRP = models.DecimalField(max_digits=10, decimal_places=2, default ='0' ) MotorImage = models.ImageField(upload_to='Car_Pics', default=False,blank=True) def __str__(self): #return self.title or '' return '%s %s %s' % (self.MotorMakeName,self.MotorModelName, self.title,) or '' def __unicode__(self): return u'%s' % (self.title) or '' class Meta: ordering = ('MotorMakeName',) View.py def … -
importing moviepy package errors in django view file
I'm working on Django rest API. On one of the endpoints, the user uploads a video and I want to resize it after that. According How To Resize a Video Clip in Python I want to use moviepy package. I've installed moviepy package with pip but I get an error on import moviepy.editor as mp which I added on top of view.py file. Error message is: ModuleNotFoundError: No module named 'moviepy'. The weird thing is when I open python console and I type the exact same line I don't get any errors. what should I do? -
TypeError: argument of type 'WindowsPath' is not iterable when i try to use a module in django
I was working on this other Django project and i was facing this error saying TypeError: argument of type 'WindowsPath' is not iterable when i try to use a module in django when I''m trying to use modules such as requests and BeautifulSoup So i found it helpuful to post it on this community maybe someone can face the same exception in the future and i fixed it by going to the settings and change instead of using the os module i used the pathlib and i modified my setting.py and looks as follows: settings.py from pathlib import Path BASE_DIR = Path(__file__).resolve().parent.parent DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', "newsapp1" ] MIDDLEWARE = [ ... ] ROOT_URLCONF = 'newsapp.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [Path.joinpath(BASE_DIR, 'templates')], #i made the changes here!!! 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'newsapp.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] ..... Thanks guys hope this will … -
Unit testing in Django & Django Rest Framework to get 100% code coverage on SonarQube
It is the first time I'm writing unit test cases I'm not much aware what all I need to test because we're using SonarQube application for code quality and etc and in SonarQube for our Django & DRF project it's showing most of the lines are not covered by unit test cases (for ex settings.py, serializers.py and etc) I was going through Django & DRF testing docs and I found that it was all about testing views (kind of integration testing). I have already written a lot of code and now I want to unit test whatever code I've written (like serializers, APIViews, URLs, models and etc) Also I read one post about testing serializers on Stack Overflow, that we don't need to write any unit test for serializers and all. Because django already does it for us. If that is the case could anyone please advise/suggest me what and all I need to test in order to get 100% code coverage on SonarQube. Kindly excuse if the question is repeated or it is an off topic question. -
Static files not found when Docker container is running in Django React app
I am trying to run my Docker image to see it on my browser yet all that appears is an empty screen, upon inspection I see the following errors: [2020-09-12 17:31:42 +0000] [12] [INFO] Starting gunicorn 20.0.4 [2020-09-12 17:31:42 +0000] [12] [INFO] Listening at: http://0.0.0.0:8000 (12) [2020-09-12 17:31:42 +0000] [12] [INFO] Using worker: sync [2020-09-12 17:31:42 +0000] [14] [INFO] Booting worker with pid: 14 Not Found: /static/js/2.8ba00362.chunk.js Not Found: /static/js/main.8eee128b.chunk.js Not Found: /static/css/2.7253a256.chunk.css Not Found: /static/css/main.a85cbe2c.chunk.css Not Found: /static/js/2.8ba00362.chunk.js Not Found: /static/js/main.8eee128b.chunk.js The commands I have run are: docker build . -t projecthub and docker run -d -p 8000:8000 --name theprojecthub projecthub:latest I am very unsure why these static files are even being looked for, I cannot seem to find any reference to them in my code. Does anybody know what I should do? -
Using get_absolute_url in a QuerySet
I'm trying to create a serialized JSON response with names array field and the absolute url of my Host model. I tried adding absolute_url to the values method in views.py but Django gave me an error because it is not a field name. How do I get the value returned by get_absolute_url into my serialized JSON response? Current JSON response { "hosts":[ { "names":[ "a.example.com" ] }, { "names":[ "b.example.com" ] } ] } Desired JSON response { "hosts":[ { "names":[ "a.example.com" ], "url": "/explore/example.com/e7ad4069-7fe5-447d-895d-633ce59d5f49" }, { "names":[ "b.example.com" ], "url": "/explore/example.com/a79b677d-ab26-46ea-83a5-ca54a3f2566e" } ] } views.py class TestApiView(View): def get(self, request, domain_name): data = list(Host.objects.filter(domain__name__exact=domain_name).values('names')) return JsonResponse({'hosts': data}) models.py class Host(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) created = models.DateTimeField(auto_now_add=True) last_updated = models.DateTimeField(auto_now=True) names = ArrayField(models.CharField(unique=True, max_length=settings.MAX_CHAR_COUNT), default=list, null=False) domain = models.ForeignKey(Domain, on_delete=models.CASCADE) class Meta: ordering = ['names'] def __str__(self): return "[Host object: id = {}, names = {}, domain = {}]".format(self.id, self.names, self.domain) def __repr__(self): return "[Host object: id = {}, names = {}, domain = {}]".format(self.id, self.names, self.domain) def __eq__(self, other): if isinstance(other, Host): return sorted(self.names) == sorted(other.names) return False def __hash__(self) -> int: return hash(tuple(sorted(self.names))) def __lt__(self, other): return self.names[0] < other.names[0] def get_absolute_url(self): return '/explore/{}/{}'.format(self.domain.name, self.id) -
Pass data form from database to modal Django
My teacher gave me schoolwork on how to pass data table to modal class in Django. I just want to display the profile click in table to modal. Any help can make me grateful thanks.I'm just a newbie here and since it was almost 2 weeks I've been starting learning django Below is my currently code and it's not working. Before | modal after accounts.html <table style="width: 100%;" id="example" class="table table-hover table-striped table-bordered"> <thead> <tr> <th>Action</th> <th>Firstname</th> <th>Lastname</th> <th>Email</th> <th>Username</th> <th>Date joined</th> </tr> </thead> <tbody> {% for user_information in user_information %} <tr> <td><a class="btn btn-info" class="open-modal" href="{{ user_information.id }}">Edit</a></td> <td>{{user_information.first_name}}</td> <td>{{user_information.last_name}}</td> <td>{{user_information.email}}</td> <td>{{user_information.username}}</td> <td>{{user_information.date_joined}}</td> </tr> {% endfor %} </tbody> </table> <div id="modal-div"></div views.py def edit(request,id): user = auth.authenticate(id=id) return render(request, 'accounts.html',{'user_information':user,'successful_submit': True}) js <script > var modalDiv = $("#modal-div"); $(".open-modal").on("click", function() { $.ajax({ url: $(this).attr("data-url"), success: function(data) { modalDiv.html(data); $("#exampleModal").modal(); } }); }); </script> -
Drop down selection on non-model form on form error
I've created a non-model form. with a modelchoicefield class BookingFormSetupForm(forms.Form): paymentmethod = forms.ModelChoiceField(queryset=PaymentMethod.objects.none(),required=False) I'm running into a problem whereby when a user selects a value on the modelchoicefield and then interacts with the rest of the form, but doesn't enter something correctly on one of the other form fields, an error on the form is thrown on save (which is good), but when the form reloads with the error message being displayed, the value that the user had selected on the modelchoicefield is no longer selected (this is bad). What is selected is the value that was last saved to this field. Is there a way to have the users previous selection be selected on the reload of the page when an error is displayed? Thanks! -
Django: How do you get user id on model.py page and set dynamically a default value
I have 2 models(Model Projects and Model Variables) in two apps (Projects app and Variables app). The models are not related in any ways. I want to set the default value in Projects with value in Variables Model Projects: class Projects(models.Model): completion_time = models.FloatField(default='0') Model Variables: class Variables(models.Model): user_var_id = models.OneToOneField(User, null=True, blank=True, on_delete=models.CASCADE) internal_completion_time = models.FloatField(default='0') I want users to set a value in the variables and when they create a new project they would have that value from the variables be set as a default value for a new project by default. eg how could i do something like this variable = Variables.Objects.Get(user_var_id=current_user_id-that i dont know how to get) class Projects(models.Model): completion_time = models.FloatField(default=variable.internal_completion_time ) I thought it could be done by adding dynamically the default value, querying the variables filtering for the user and adding the value to the model but i dont know how to get the current user id on the model.py page. How can i do this maybe with another method. -
How to show icon in Django?
I gave the script of the font awesome to my head of the HTML but it is showing the squares instead of the icons. Code is : <!DOCTYPE html> {% load static %} <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="{% static "all.css" %}"> <link rel="stylesheet" href="{% static "bootstrap.css" %}"> <link rel="stylesheet" href="{%static "style.css" %}"> <link href="https://fonts.googleapis.com/css2?family=Candal&family=Lora&display=swap" rel="stylesheet"> <title>Online yuridik xizmatlar</title> <script src="//code.jivosite.com/widget/pvNOxCEa74" async></script> <!--Font Awesome --> <script src="https://use.fontawesome.com/6cd0e4d425.js"></script> <style> #loader{ position: fixed; width: 100%; height: 100vh; background: #000000 url('../static/contact/images/Infinity-1s-200px.gif') no-repeat center; z-index: 99999; } </style> </head> -
Firebase or Django for a social network app
Good Morning. I have an idea about a social network and I have some knowledge of web application development. The fact is that I have serious doubts about how to design the app; the application would be for Android and would connect to the server. I was thinking and looking for information about firebase hosting, but I have no experience with that. Instead, I have experience with Django. What do you recommend for me to develop the backend, develop it in Django and run it on a server or use firebase services? I have to say that I'm in college and I don't mind using something I haven't used before; precisely, my goal is to learn. Perhaps I am very wrong in everything, I would like to read other alternatives. The volume of users would not be excessively large, and the volume of data to be stored would be basic data and a few photos per profile created. -
How to Get Data Out of a Django Model and in to the HTML Template
I have an AttendanceReport model where staff register information such as the feedback and the number of hours worked "nbr_heures" My model: class AttendanceReport(models.Model): id=models.AutoField(primary_key=True) consultant_id=models.ForeignKey(Consultant,on_delete=models.DO_NOTHING) mission_id=models.ForeignKey(Mission,on_delete=models.CASCADE,null=True) session_year_id=models.ForeignKey(SessionYearModel,on_delete=models.CASCADE, null=True) nbr_heures = models.IntegerField(blank=False) feedback = models.TextField(max_length=255,null=True, default="") created_at=models.DateTimeField(auto_now_add=True) updated_at=models.DateTimeField(auto_now_add=True) objects=models.Manager() I'm trying to the sum the values of 'nbr_heures' How can i properly do that ? I tried this but its not working.. hours_count=AttendanceReport.objects.annotate(nbr_heur=Sum('nbr_heures')) Thank you in advance. -
Search bar using Django to search in a JSON file?
I am trying to create a search bar that searches in a JSON file that has previously been added to a table using Django views and HTML. The JSON file is directly added from the user. This is part of the Django views: if url_parameter: music = context["music"].filter(name__icontains=url_parameter) else: music = context["music"] if request.is_ajax(): html = render_to_string( template_name="music_table.html", context=context ) data_dict = {"html_from_view": html} return JsonResponse(data=data_dict, safe=False) return render(request, "index.html", context=context) The Django view has to be the same for the upload and the search. The search is live so that it automatically changes what displayed in the html table. -
Django localhost redirected you too many times "ERR_TOO_MANY_REDIRECTS" when trying to signin
in my project i had two views in two separate templates for some reason i needed those two views in a single template that already has a view after i added them i started facing this issue when i removed them it stopped note that those two views were working properly when it was in two separate templates in my views.py here is the view that has those two views that were separate i'll be pointing to them with comments from django.shortcuts import render, redirect from django.contrib.auth import login, authenticate, logout as django_logout from django.urls import reverse from .models import * from .forms import * def home(request): user = request.user # it had only this creating a post part form = TextForm() if request.method == "POST": form = TextForm(request.POST) if form.is_valid(): obj = form.save(commit=False) author = User.objects.filter(email=user.email).first() obj.author = author form.save() form = TextForm() texts = Text.objects.all().order_by('-id') # here is the other view that i added it's for signing in if user.is_authenticated: return redirect("home") if request.POST: signin_form = SigninForm(request.POST) if signin_form.is_valid(): email = request.POST['email'] password = request.POST['password'] user = authenticate(email=email, password=password) if user: login(request, user) return redirect("home") else: signin_form = SigninForm() # and here is the other one,it's for signing … -
How to properly design a database for rating system with multiple rating criterias
I am doing rating system on my current django project and I need to implement database for rating. Database would be simple, if I didn't have multiple rating criteries, now I have to ask: How would you design a database with these objects: User RatedObject Rating there will ofcourse be multiple users and objects to be rated AND multiple rating criterias. Now my current idea would be to go for few separate tables with each of the objects such as: USER(pk=id, fk= rating.id) RATED_OBJECT(pk=id, fk= rating.id, overall_attribute_1, overall_attribute_2, overall_rating) RATING(pk=user.id, pk=rated_object.id, fk=rated_attribute1, fk=rated_attribute2) RATED_ATRIBUTE(pk=id, fk=type, value) TYPE(pk=id, name) - 2 types since we have 2 attributes to be rated (now overal_rating will be average of all overall attributes and each overal attribute will be average of all attributes of one type from ratings, where the id of rated object will be same) I have a bad feeling about doing this 'multiple-FK-to-one-PK' operation. Would it make more sence to make table for each rated attribute? Or maybe say **** it and have values in the RATING itself and screw RATED_ATTRIBUTE and TYPE table? What do you guys think? -
Assign values to Django form fields without using initial? [closed]
Im tryin to create a django form with two int(Salary, days) and one disabled fields(Total). I want it to work in a way when user clicks on submit it prompts the user with Total salary in that disable field. I tried doing it using clean method, didnt work. Is there any other way to do it!? -
Django Rest Framework Serializer do not want to accept returned list, and returns AttributeError 'str' object has no attribute 'x'
So I'm trying to aggregate a list of colors and return the queryset to the serializer, the serialzier, however, does not seem to accept this for some reason. When running the the commands in shell i get: >>> from django.contrib.postgres.aggregates import ArrayAgg >>> from inventory.models import Product >>> products = Product.objects.filter(category__parent__name__iexact='fliser').distinct().aggregate(colors_field=ArrayAgg('colors__name')) >>> print(products) {'colors_field': ['Beige', 'Grå', 'Hvit', 'Sort', 'Beige', 'Gul', 'Rød']} Which is the expected result. The serializer is structured like this: class ProductFiltersByCategorySerializer(serializers.ModelSerializer): """ A serializer to display available filters for a product lust """ colors = serializers.StringRelatedField(read_only=True, many=True) class Meta: model = Product fields = ['colors'] The viewset looks like this: class ProductFiltersByCategory(generics.ListAPIView): """ This viewset takes the category parameter from the url and returns related product filters """ serializer_class = ProductFiltersByCategorySerializer def get_queryset(self): category = self.kwargs['category'] queryset = Product.objects.filter(category__parent__name__iexact=category).distinct().aggregate(colors_field=ArrayAgg('colors__name')) return queryset And the relevant part of the model looks like this: class Product(models.Model): ... colors = models.ManyToManyField( ProductColor, related_name='product_color' ) ... The error when trying to access the endpoint is 'str' object has no attribute 'colors'. -
Django in GAE - OAuth 2.0 redirecting to localhost - authorization problem
I am quite new to python and especially app deployment. My goal is to create an app that is using multiple Google APIs and running on a schedule. For testing purposes, I created a django app which is simply appending a row into a Google Sheet with the current timestamp. I created the Google API credentials for an installed app, as I want this script to run in the background. Everything is working fine when running the app on the localhost: I visit the localhost path which is triggering the script and I'm redirected to the Google authentication page. After authorization, I end up and the "you may close this window" page and the testing Google Sheet is appended correctly. However, when I deploy the app on App Engine, I see the authorization screen, but after the confirmation I am redirected to the localhost, and get the warning: "this site can't be reached localhost refused to connect". As for the credentials JSON, the following redirect_uris are listed: ["urn:ietf:wg:oauth:2.0:oob","http://localhost"] But I also tried removing the localhost from there, without a result. My goal is to have an app which is using Google Sheets as an interface, so I'm not sure if … -
django: password change template customization
I want to change password change template in django but I cant. django is seeing the django/contrib/admin/templates/registration/ versions of the templates instead of my beautifully crafted myapp/templates/registration/password*.html urls.py from django.contrib.auth.views import PasswordChangeDoneView,PasswordChangeView urlpatterns = [ path('password_change/', PasswordChangeView.as_view(), name='password_change'), path('password_change/done/', PasswordChangeDoneView.as_view(), name='password_change_done'), ] setting.py TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')] , 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] -
Django error Invalid block tag on line 21: 'endblock'. Did you forget to register or load this tag? How do i fix it
{% extends 'miromi_first/base_template.html' %} {% load static %} {% block content %} <img src="{% static 'miromi_first/images/miromi_logo.png' %}" /> <div class="topnav"> <div class="topnav-right"> <a href="#about">Login</a> </div> </div> <div class="main-stuff"> <h2>Welcome to Our fashion app</h2> <h4> Lorem ipsum dolor sit amet consectetur adipisicing elit. Natus voluptates nihil corrupti incidunt hic, quasi fugiat quaerat esse veniam sed, blanditiis voluptatem saepe velit eligendi voluptas dicta architecto doloremque magnam. </h4> </div> {% endblock %} I try to load the image i want using this but get the error : Invalid block tag on line 22: 'endblock'. Did you forget to register or load this tag? in django (if i remoce the load static and image URL stuff it works fine -
Get the url from custom tag in beautifulsoup$
I need to get url the from custom html tag. So im extracting the img like this qwe = [] for x in carList: try: carPicture = x.find('img', class_="lazyload", attrs={"data-src":True}) except: carPicture = static("images/human.jpg") qwe.append(carPicture) The result of that is: <img class="lazyload" data-src="https://prod.pictures.autoscout24.net/listing-images/58878dbf-083a-4685-af3a-f745a6534426_cdde08fb-999b-488a-86c8-d252bcadaaff.jpg/420x315.jpg"/> How can i get only the link from data-src tag? -
Django 'User' object has no attribute 'profile' when I'm trying to log in
I had a OneToOne Field relation, but when I added a related name attribute to it, every time I try to log in I get this error: 'User' object has no attribute 'profile' Profile model: from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver # Create your models here. class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='user_profile') weight = models.FloatField(max_length=20, blank=True, null=True) height = models.FloatField(max_length=20, blank=True, null=True) goal = models.FloatField(max_length=20, blank=True, null=True) def __str__(self): return self.user.username @receiver(post_save, sender=User) def create_user_profile(sender, instance, created, **kwargs): if created: Profile.objects.create(user=instance) @receiver(post_save, sender=User) def save_user_profile(sender, instance, **kwargs): instance.profile.save() -
IntegrityError at /admin/auth/user/11/delete/ FOREIGN KEY constraint failed
when i delete user from my admin panel it shows me given error I dont understand what is the reason of this error or where i am making mistake. I can update and create new users and delete those user who dont have profile but the users which have profiles they are unable to delete because of the following here which i given below. accounts/models.py from django.urls import reverse from django.db import models from django.contrib import auth from PIL import Image from django.db.models.signals import post_save from django.dispatch import receiver # Create your models here. class User(auth.models.User,auth.models.PermissionsMixin): def __str__(self): return "@{}".format(self.username) class Profile(models.Model): user = models.OneToOneField(auth.models.User, on_delete=models.CASCADE) avatar = models.ImageField(default='1.jpg', upload_to='displays', height_field=None, width_field=None, max_length=None) def __str__(self): return f'{self.user.username} Profile' def save(self,*args, **kwargs): super(Profile,self).save(*args, **kwargs) #it will take data and save it dp = Image.open(self.avatar.path) #storing avatar in variable if dp.height >300 or dp.width >300: output_size =(300,300) #set any size you want dp.thumbnail(output_size) dp.save(self.avatar.path) #after resizing it save it in data base in place of uploaded once by user def get_absolute_url(self): return reverse("Profile_detail", kwargs={"pk": self.pk}) @receiver(post_save, sender=User) def create_profile(sender, created,instance,**kwargs): if created: Profile.objects.create(user=instance) @receiver(post_save, sender=User) def save_profile(sender, instance,**kwargs): instance.profile.save() accounts/forms.py from django import forms from django.contrib.auth.forms import UserCreationForm from django.core.exceptions import ValidationError … -
create a folder for each user automatically when they first sign-up and saving their files to it
So I am trying to create a folder automatically for each user as soon as they sign up. This is my code: def create_folder(instance): folder = Path("users/myfolder/".format(instance.user)).mkdir(parents= True, exist_ok= True) return folder class MyModel(models.Model): folder_to_upload = models.FileField(upload_to= create_folder, null= True) The folder does not get created unless I upload a file. What I want to achieve is, to create a folder for each user automatically when they first sign-up, so the users can save their files to it.