Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Modification in serializer.data format before returning jsonresponse
I am getting- [ { "id": 2, "url": "https://emiactech.com/", "title": "", "blog_post": 0, "index_count": 0, "external_urls": "[{'url': '#', 'page': 'https://emiactech.com/', 'title': u''}, {'url': 'https://www.facebook.com/EMIACTechnologies/', 'page': 'https://emiactech.com/', 'title': u'Facebook'}, {'url': 'https://twitter.com/emiactech', 'page': 'https://emiactech.com/', 'title': u'Twitter'}, {'url': 'mailto:sales@emiactech.com', 'page': 'https://emiactech.com/', 'title': u'sales@emiactech.com'}, {'url': 'http://themeforest.net/item/avada-responsive-multipurpose-theme/2833226?ref=ThemeFusion', 'page': 'https://emiactech.com/about-us/', 'title': u''}, {'url': '#tab-bdf4143f2c7b5609720', 'page': 'https://emiactech.com/services/', 'title': u'Web Design and Development'}, {'url': '#tab-70d2572b15f9a5ac477', 'page': 'https://emiactech.com/services/', 'title': u'Content Development'}, {'url': '#tab-c59a00bf26295e6ed39', 'page': 'https://emiactech.com/services/', 'title': u'Digital Marketing'}, {'url': 'https://emiactech.com', 'page': 'https://emiactech.com/cqpim-client/', 'title': u'Home'}, {'url': 'http://themetf.com', 'page': 'https://emiactech.com/portfolio-items/humsafar-love/', 'title': u' theme-tf'}, {'url': 'http://shades.salon', 'page': 'https://emiactech.com/portfolio_category/jquery/', 'title': u'http://shades.salon'}, {'url': 'http://Project%20URL', 'page': 'https://emiactech.com/portfolio_category/jquery/', 'title': u' View Project '}, {'url': 'http://samacharjagat.com', 'page': 'https://emiactech.com/portfolio_category/jquery/', 'title': u'http://samacharjagat.com'}]", "external_count": 13 }] in serializer.data . external_urls key data is the type of string. I need this key data either in the form of list or dictionary something like this; [{'url': '#', 'page': 'https://emiactech.com/', 'title': u''}, {'url': 'https://www.facebook.com/EMIACTechnologies/', 'page': 'https://emiactech.com/', 'title': u'Facebook'}, {'url': 'https://twitter.com/emiactech', 'page': 'https://emiactech.com/', 'title': u'Twitter'}, {'url': 'mailto:sales@emiactech.com', 'page': 'https://emiactech.com/', 'title': u'sales@emiactech.com'}, {'url': 'http://themeforest.net/item/avada-responsive-multipurpose-theme/2833226?ref=ThemeFusion', 'page': 'https://emiactech.com/about-us/', 'title': u''}, {'url': '#tab-bdf4143f2c7b5609720', 'page': 'https://emiactech.com/services/', 'title': u'Web Design and Development'}, {'url': '#tab-70d2572b15f9a5ac477', 'page': 'https://emiactech.com/services/', 'title': u'Content Development'}, {'url': '#tab-c59a00bf26295e6ed39', 'page': 'https://emiactech.com/services/', 'title': u'Digital Marketing'}, {'url': 'https://emiactech.com', 'page': 'https://emiactech.com/cqpim-client/', 'title': u'Home'}, {'url': 'http://themetf.com', 'page': 'https://emiactech.com/portfolio-items/humsafar-love/', 'title': u' theme-tf'}, {'url': … -
How to build non-linear throttling for authentication APIs in Django rest framework ?
DRF offers in-built throttling system where we can define rate limit. But how can we make it more secure by exponentially increasing the time limit of an API? Ie, if you make more than 10 calls/min to login API next min should allow only 5 API calls and so on. Time between subsequent API calls should increase exponentially until it hits a predefined threshold after which user should be blocked permanently. -
Django file sharing between users
I am creating file sharing app. i have multiple user. plz find below my forms.py from django import forms from django.contrib.auth.models import User from Box.models import user_files class Loginform(forms.Form): username=forms.CharField(max_length=50) password=forms.CharField(widget=forms.PasswordInput) class UserRegistration(forms.ModelForm): password = forms.CharField(label='Password',widget=forms.PasswordInput) password2 = forms.CharField(label='Repeat Password',widget=forms.PasswordInput) class Meta: model=User fields= ('username','first_name','email') def clean_password2(self): cd=self.cleaned_data if cd['password']!=cd['password2']: raise forms.ValidationError('Passwords do not match') return cd['password2'] class Fileupload(forms.ModelForm): class Meta: model= user_files fields = ('Filename','Browse') and my model.py from django.db import models class user_files(models.Model): Filename = models.CharField(max_length=50) Browse = models.FileField() i have used django in built user model to store user data and model user_files for storing files. So now how can i distinguish which file is uploaded by which user? and how can i share among other user? i am stuck at this point. Thanks in advance -
How to add css class to Django admin form
I was wondering if it's possible to add a css class to the Django admin form? For example: @admin.register(SomeFunction) class SomeFunctionAdmin(SortableAdmin): fieldsets = ( (None, { 'fields': ('item1', 'item2', 'item3'), }), ) def get_form(self, request, obj=None, **kwargs): form = super(SomeFunctionAdmin, self).get_form(request, obj, **kwargs) return form class Media: js = ( 'custom.js', ) Now I want to add a css class to SomeFunctionAdmin, let's say I want to add .custom-form-admin class. And in my custom.js file I have some functions which search for this custom css class. How do I add the custom css class programatically to SomeFunctionAdmin? I imagne the code would look something like this: @admin.register(SomeFunction) class SomeFunctionAdmin(SortableAdmin): fieldsets = ( (None, { 'fields': ('item1', 'item2', 'item3'), }), ) def get_form(self, request, obj=None, **kwargs): form = super(SomeFunctionAdmin, self).get_form(request, obj, **kwargs) form.set_css += 'custom-form-admin' return form class Media: js = ( 'custom.js', ) -
Accessing the twitter tweets in Django application creating issues
For integrating my application with tweeter to access the tweets, I have followed this blog: https://simpleisbetterthancomplex.com/tutorial/2016/10/24/how-to-add-social-login-to-django.html I think I have integrated the application but here the error that I am getting: AuthForbidden at /oauth/complete/twitter/ Your credentials aren't allowed Request Method: GET Request URL: http://52.66.181.149:2000/oauth/complete/twitter/?redirect_state=26j2fjzqwJPBVlhv0bZBvlAjLTzp0uJl&oauth_token=krMPogAAAAAA2fYTAAABXut57Og&oauth_verifier=Tbg7RQbbZFLFzWShi19izoQSHLePYSPS Django Version: 1.11.5 Exception Type: AuthForbidden Exception Value: Your credentials aren't allowed Exception Location: /usr/local/lib/python2.7/dist-packages/social_core/utils.py in wrapper, line 257 Python Executable: /usr/bin/python Python Version: 2.7.12 Python Path: ['/home/ubuntu/Personality', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages'] Server time: My time The complete trace back is here : Trace Back Gist Also, I would like to know the following 2 things: 1) What is missing which is causing this issue? 2) What I can do to collect the tweets with django and use it as NLP data set? Kindly, let me know. -
How to run django localhost on another system in same private network
I am using django for my project. Now I want to access my project. Both my system and the another one are in the same private network. I am using VPN to connect to the network. How can I access http://localhost:8000 from another system? What all I did: ALLOWED_HOSTS = ['*'] DEBUG = False python manage.py runserver 0.0.0.0:8000 Using my IP (say 192.168.x.y) from another system to access the page, but no use - I still couldn't access the page. (I can access the page http://192.168.x.y:8000/home from the browser of the same system though) My main motive is to launch the application and to be able to use it from a system - both server and client machine are in same private network connected either by VPN or LAN -
How to design subscription plan(stripe) based permissions in Django rest framework?
I'm building a SaaS product where subscription happens with the integration of Stripe. I have multiple subscription plans and certain APIs are restricted to advanced/premium plans only. How do I build API permissions so that it works well with dynamic plans? Plans can be added or deleted at Stripe's dashboard which gets synced with my backend models. Is there a way to associate certain endpoints to a plan using admin panel without modifying the codebase? -
django sending mail [Errno -2] Name or service not known
i'm using django-registration in my project to sending email when user forgot password. But i got the error [Errno -2] Name or service not known. Below are my settings and traceback.. EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_USE_TLS = True EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'my@gmail.com' EMAIL_HOST_PASSWORD = 'mypassword' EMAIL_PORT = 587 gaierror at /accounts/password_reset/ [Errno -2] Name or service not known Request Method: POST Request URL: http://localhost:8000/accounts/password_reset/ Django Version: 1.10.5 Exception Type: gaierror Exception Value: [Errno -2] Name or service not known Exception Location: /usr/lib/python2.7/socket.py in create_connection, line 553 Python Executable: /usr/bin/python Python Version: 2.7.6 Python Path: ['/vagrant/ifoswork/ifoswork', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages'] Server time: Thu, 5 Oct 2017 14:38:34 +0800 -
Price model in Django
How can I create a pricing model in Django? Is there any package like django-prices or django-moneyfield? I want to create a model in such a way that user can select the items and price keeps updating as he starts adding the items. For me to have this model, I wanted the price update to happen on the same page as the user adds item so that he can see the changes. Since I am new to Django, I am not sure what model will work for me. Or do I need to manually prepare the code base for estimates? Has anyone worked on such requirement before? -
how i get request objects in django singnals
i used "pre_save" django signal for creating some activity log object in models.py but in my activity log models have created_by and updated_by fields so i want to access user object in that particular django signals @receiver(pre_save, sender=ProjectSow) def change_order_updated(sender, **kwargs): instance = kwargs.get('instance') component_id = instance.pk log = ActivityLog.objects.create(component_id=component_id, component="change_oreder",log="project created_created") so how we do that i also try with created one custom context processor also but it not work -
Where is Django base.html file? Add additional static style sheet
I would like copy & use the admin/base.html file in my templates/accounts folder. So I can hopefully include one additional custom style sheet in the head. I have used the: python -c "import django; print(django.__path__)" previously to locate & copy the user admin forms. When I follow the path generated from the line above I now get a path to .py files rather than .html files. Does anyone have a copy of the base.html file? Or can suggest the cleanest way to include one additional style sheet? This is what I am trying to avoid if possible. base_site.html {% extends "admin/base.html" %} {% block title %}{{ title }} | {{ site_title|default:_('MY SITE') }}{% endblock %} <!--CAN THIS BE ADDED TO THE HEAD OF base.html--> {% block body_head %} <link href="{% static 'css/custom.css' %}" rel="stylesheet"> {% endblock body_head %} {% block branding %} <h1 id="site-name"><a href="{% url 'admin:index' %}">MY SITE</a></h1> {% endblock %} {% block nav-global %}{% endblock %} -
Django & Python AttributeError: 'Retailer' object has no attribute
In my test file: class TestMakeSoup(TestCase): fixtures = ['deals_test_data.json'] def test_string_is_valid(self): s = Retailer.objects.get(pk=1) with open('/home/danny/PycharmProjects/askarby/deals/tests/BestBuyTest.html', 'r') as myfile: text = myfile.read().replace('\n', '') self.assertTrue(s.make_soup(text)) In the file it's testing: class retailer(): ''' Retail site, drawn from database queryset object ''' def __init__(self,r_object): ''' Initializes retailer variables obj -> nonetype Precondition: r_object.currency == 3 Precondition: r_object.name != None ''' assert len(r_object.currency) == 3, "{} must be a three-letter string (eg 'USD').".format(r_object.currency) assert r_object.name != None, "Name must exist." assert r_object.deal_container_css != None, "Title css must exist." assert r_object.title_css != None, "Title css must exist." assert r_object.price_css != None, "Price css must exist." self.name = r_object.name self.base_url = r_object.base_url self.currency = r_object.currency #dict containing css lookup values for various fields self.css = {} self.css['container'] = self.extract_css(r_object.deal_container_css) self.css['title'] = self.extract_css(r_object.title_css) self.css['product_model'] = self.extract_css(r_object.product_model_css) self.css['price'] = self.extract_css(r_object.price_css) self.css['old_price'] = self.extract_css(r_object.old_price_css) self.css['brand'] = self.extract_css(r_object.brand_css) self.css['image'] = self.extract_css(r_object.image_css) self.css['description'] = self.extract_css(r_object.description_css) self.css['exclude'] = self.extract_css(r_object.exclude_css) self.css['shipping'] = self.extract_css(r_object.shipping_css) #dict containing associated clearance urls for retailer self.clearance_urls = self.get_clearance_urls() #dict to house final list of deals self.deals = {} def __str__(self): return self.name def make_soup(self, text): assert isinstance(text,str), "text must be string." soup = bs4.BeautifulSoup(text, "html.parser") if soup: return soup return False The Retailer call refers to the … -
AttributeError: 'CustomUser' object has no attribute 'first_name'
what this error means ? AttributeError: 'CustomUser' object has no attribute 'first_name' custom_user/models.py from time import timezone from django.db import models from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin from django.core.mail import send_mail from django.utils.translation import ugettext_lazy as _ from datetime import datetime now = datetime.now() class CustomUserManager(BaseUserManager): def _create_user(self, email, password, is_staff, is_superuser, **extra_fields): """ Creates and saves a User with the given email and password. """ if not email: raise ValueError('The given email must be set') email = self.normalize_email(email) user = self.model(email=email, is_staff=is_staff, is_active=True, is_superuser=is_superuser, last_login=now, **extra_fields) user.set_password(password) user.save(using=self._db) return user def create_user(self, email, password=None, **extra_fields): return self._create_user(email, password, False, False, **extra_fields) def create_superuser(self, email, password, **extra_fields): return self._create_user(email, password, True, True, **extra_fields) class CustomUser(AbstractBaseUser, PermissionsMixin): username = models.CharField(max_length=254, unique=True) email = models.EmailField(blank=True, unique=True) address1 = models.CharField(max_length=254, blank=True) address2 = models.CharField(max_length=254, blank=True) area_code = models.CharField(max_length=20, blank=True) country_code = models.CharField(max_length=10, blank=True) is_active = models.BooleanField(default=True) is_admin = models.BooleanField(default=False) is_staff = models.BooleanField(default=False) is_superuser = models.BooleanField(default=False) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['username', 'address1', 'address2', 'area_code', 'country_code'] objects = CustomUserManager() class Meta: verbose_name = _('user') verbose_name_plural = _('users') def get_full_name(self): """ Returns the first_name plus the last_name, with a space in between. """ full_name = '%s %s' % (self.first_name, self.last_name) return full_name.strip() def get_short_name(self): "Returns … -
How do I access the `BLOG_SUG` string?
When I type {{ setting }} on a template and open it with Mezzanine, it shows me {u'MEZZANINE_ADMIN_PREFIX': u'grappelli/'}. I'm trying to access settings.BLOG_SLUG, but cannot get that setting to appear in the template. Here's a small snip of what my template looks like. {% load mezzanine_tags keyword_tags i18n %} {% block main %} {{ settings }} {% endblock %} How do I get my template to display the string stored in setting.BLOG_SLUG? -
How to set a variable using set tag in django?
I want something like this. {% set titles = { 'table': form._meta.model._meta.verbose_name_plural.title(), 'form': form._meta.model._meta.verbose_name.title() } %} {% set dtable = "dt_" + page %} How can I get set tag? Your answer would be helpful for me. -
Django - Starting a MQTT service in INIT prevents me from loading models with "Apps aren't loaded yet." error. Where can I start it?
I'm brand new to Django and Python, and not sure how to get around this problem, but I know what's wrong and why... I'm connecting to a MQTT broker (internet of things messaging protocol / provider) so I can update a webpage with data from some sensors I have. I've started the MQTT service in my init as was suggested below, but I don't know enough to know if that's right or wrong, but it works. https://stackoverflow.com/a/41017210/2408033 My problem happens, when I want to try to update my database with the messages I receive from the MQTT broker. I need to import my model so I can update it, but the model hasn't been loaded yet, and it throws the error - "Apps aren't loaded yet." I was reading that you shouldn't attempt to import models before the Django setup has run (which is after init) so I'm not sure where / how to start the loop for the MQTT broker thread? Where else can I place the code to start the loop where it won't be triggered a second time? -
Django error in creating model
I'm having an issue with creating a user profile with a foreign object. I have a user and I want to attach an account type to that user. model.py from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import User class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) account = models.ForeignKey(Account, unique=True) class Account(models.Model): reports = models.IntegerField(default=3) accounttype = models.CharField(default='Free', max_length=250) description = models.CharField(default='N/A', max_length=250) monthlycost = models.FloatField(default=0.0) def __str__(self): return self.user.username + " - " + self.accounttype The issue is I'm getting the below error: account = models.ForeignKey(Account, unique=True) NameError: name 'Account' is not defined How do I call the Account class for the foreign key? -
Django Integrity Error "Column 'section_id' cannot be null"
I have seen many questions regarding this error in Django, but I'm at a loss because as far as I can tell, no table in my database has a section_id column. I get the error when a user attempts to register and views.py attempts to create a user. I recently changed the "Profile" model (Profile objects are automatically created alongside User objects) in my application to have a section attribute rather than a section_id attribute, but I reset the migrations and recreated the database several times. I'm thinking that it may be an issue with making the migrations, but I really have no idea. Here is the profile model that used to have a section_id attribute: class Profile(models.Model): """ An extension of the built-in Django user model to allow for the different types of users """ USER_TYPES = ( ('S', 'Student'), ('I', 'Instructor'), ('C', 'Client') ) user = models.OneToOneField(User, on_delete=models.CASCADE) user_type = models.CharField(max_length=1, choices=USER_TYPES) section = models.ForeignKey(Section, default=None) @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): if instance.is_staff != 1: instance.profile.save() And here is the code that is raising the error: new_user = User.objects.create_user(email, email=email, password=password) -
How to display a error message to the user by redirecting to current page - django
I have a question that I feel like I solved before but for some reason, I just cant figure it out. I have a django view that will update a users informaiotn that is stored in the data base that involves the user entering his current password, a new password, and verification of the new password. I have the processing complete fo rthe situation where the user enters all of the correct information. I am not trying to add hte else statements just in case the user does not enter the current existing password or the passwords dont match. In the two commented lines in the else statements is where I want display the current html template with the form and have a message that displays a message that is assigned for different errors that exist. if 'passwordSubmit' in request.POST: updatePassword = updatePasswordForm(request.POST) if updatePassword.is_valid(): cd = updatePassword.cleaned_data old_password = cd['old_password'] new_password = cd['new_password'] verify_password = cd['verify_password'] user = authenticate(username=currentUser.username, password=old_password) if user is not None: if new_password == verify_password: secure_password = make_password(new_password) update_user = currentUser update_user.password = secured_password update_user.save() else: message = 'The two passwords do not match' # if the passwords do no match else: message = 'The … -
How to squash Django migrations with lazy references?
I have a Django 1.11 project and I'm trying to squash all migrations by deleting and re-making all of them. However, when I go to run manage.py makemigrations I get an error like: ValueError: The field app1.Model1.campaign was declared with a lazy reference to 'app2.Campaign', but app 'app2' isn't installed. However, app2 is definitely installed. I even print out my INSTALLED_APPS list in my settings.py to confirm it is. What's causing this error? -
Django file upload and creating directories
I am trying to implement dropbox application using django. I completed with user login,signup part . Also with with some authentications. Now i want to implement file uploads , creating directories and sharing files with users. Also preview of uploaded files for respective user. Right now i have extended user model for setting user. I have not written any model. How should i proceed further? a new model is necessary for this application? thanks in advance -
Django models to have a shared calculated field
I have 3 Django models that shared a few common attributes and then they have lot of other attributes that make them different. Example: Model1 quality_score other attributes specific to Model1 Model2 quality_score other attributes specific to Model2 Model3 quality_score other attributes specific to Model3 I need to create a calculated field like this: def _get_quality_band(self): if self.quality_score is None: return '' elif self.quality_score > 0 and self.quality_score <= 10: return 'bad' elif self.quality_score > 10 and self.quality_score <= 19: return 'average' elif self.quality_score > 19 and self.quality_score <= 28: return 'good' else: return '' quality_band = property(_get_quality_band) Is there a way to make the 3 models share this property instead creating it in every model? Appreciate the help. -
Invalidate browser cache for static files in Django
In Django we have ManifestStaticFilesStorage for caching static files, but it works between Django and browser, but I want right cache between user and browser. I want: every time static file is changed, hash of file is recalculated and browser cache is invalidated and user see new static file without F5 adn without running --collectstatic --no-input. My code now isn't working: settings.py STATICFILES_STORAGE = 'auth.utils.HashPathStaticFilesStorage' CACHES = { 'staticfiles': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'staticfiles', 'TIMEOUT': 3600 * 24 * 7, 'MAX_ENTRIES': 100, } } and auth.utils.py: # -*- coding: utf-8 -*- import time from hashlib import sha384 from django.conf import settings from django.core.cache import cache from django.contrib.staticfiles.storage import ManifestStaticFilesStorage try: ACCURACY = settings.STATICFILES_HASH_ACCURACY except AttributeError: ACCURACY = 12 try: KEY_PREFIX = settings.STATICFILES_HASH_KEY_PREFIX except AttributeError: KEY_PREFIX = 'staticfiles_hash' class HashPathStaticFilesStorage(ManifestStaticFilesStorage): """A static file storage that returns a unique url based on the contents of the file. When a static file is changed the url will also change, forcing all browsers to download the new version of the file. The uniqueness of the url is a GET parameter added to the end of it. It contains the first 12 characters of the SHA3 sum of the contents of the file. Example: {% … -
Python subprocess behaves different when called from Django vs unit test
My first time posting - please go easy on me. I could not come up with a succinct title that summarizes this issue. I seem to have a codec problem. My django-based website calls a subprocess (soffice) to convert uploaded documents to basic text files, to then go on to do some processing of the text from the doc. This was working beautifully for a time. On my local dev machine, the unit tests for file conversion still work perfect as does the complete django app, end-to-end. On the production server, where it all used to work, the file conversion call no longer works the same from within the django app, while it does work properly when run from the test code. This change in behavior appears to be the result of running general server updates. args = ['soffice', '--headless', '--convert-to', 'txt:Text', '--outdir', outDir, filePath] subprocess.call(args) fo = open(textFilePath, "r") try: docText = fo.read() except: print("Failed to read", textFilePath) docText = None I removed some of the error checking to simplify a bit. When I run the file conversion code as part of the complete django application on the production server, I can see that certain special characters such as … -
how do I delay and get after a return with celery and django?
Currently trying to clean how celery works with django which was told can work asynchronous I have run the simple celery task which works fine following the documentation so I do believe I have celery installed and running fine. But somehow I am not sure how it can work and run after a return for example I have this as to create a new user task @app.task def new_user(first, last, table): user = UserProfile() user.first_name = first user.last_name = last user.table = table user.save() return user I have a post api call just to make it as a sample on how celery works. I have this in my view class List(View): def post(self, request): all_users = UserMQS().profile() output = [] for user in all_users: output.append({ 'id': user.id, 'first_name': user.first_name, 'last_name': user.last_name }) ns = new_user.s('First Name1', 'Last Name1', "Table1") res = ns.delay() return JsonResponse(output, safe=False) res.get() I also tried something like new_user.delay('First Name1', 'Last Name1', "Table1") but doesn't work though. Can someone give me an idea how this can be done? I want the return JsonResponse to be running WHILE new_user is created. This isn't just for creating new_user I am just doing it to test how celery works so …