Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Rpy2 in python 3.6 working sometimes and sometimes not
i am using rpy2 to run my R script in django project where python is 3.6 and i came across a weird error.sometimes my whole code is working and sometimes r object is NULL . > path2script = os.path.join(settings.BASE_DIR, 'r_scripts', 'script.R') > ro.globalenv['args'] = ro.vectors.StrVector([txt_path]) > obj = ro.r.source(path2script) > returnarray = np.array(obj,dtype="object") exactly at the third line python returns me an error which says "TypeError: 'NULLType' object is not callable" and again after sometime the same code works without any error.How robject is getting NULL . Any help would be appreciated. -
The text printed out for the Question class is not the text that I expect
from django.db import models from django.utils import timezone import datetime class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __str__(self): return self.question_text def was_published_recently(self): return self.pub_date >= timezone.now() - datetime.timedelta(days=1) class Choice(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0) def __str__(self): return self.choice_text When I follow the tutorial for Django, I found a problem that when I run Question.objects.all(), it then only printed out the class name instead of the text that I had already set. May I ask what is the method that I could print the text out instead of only printing the class name every time? -
Simple caching mechanism for Django manager functions
I have some Django simple manager functions where I'd like to cache the response (using Memcached), and invalidate these on model save/delete. I thought there'd be a standard solution for this in the Django community, but I can't find one, so would like to check I'm not reinventing the wheel. Here's an example with a possible solution using django-cache-memoize from cache_memoize import cache_memoize from django.utils.decorators import method_decorator from django.db.models.signals import post_save, post_delete from django.conf import settings class MyModel(Model): name = models.CharField() is_live = models.BooleanField() objects = MyModelManager() class MyModelManager(Manager): @method_decorator(cache_memoize(settings.CACHE_TTL, prefix='_get_live')) def _get_live(self): return super().get_queryset().filter(is_live=True) def example_queryset(): return self._get_live() # Cache invalidation def clear_manager_cache(sender, instance, *args, **kwargs): MyModel.objects._get_live.invalidate(MyModel) post_save.connect(clear_manager_cache, sender=MyModel, weak=False) post_delete.connect(clear_manager_cache, sender=MyModel, weak=False) This seems to work, but strikes me as quite a lot of boilerplate for something that's a pretty standard Django pattern/use-case. Are there any simpler solutions out there to achieve a similar thing? -
Django quickbook-desktop web connector integration
i am new to quickbooks and i am using django-quickbooks module to integrate with django and quickbooks desktop. So i was following this documentation https://github.com/weltlink/django-quickbooks and i have completed all the steps given now i am confused that what is the next part? webapp is still not connected with webconnector. How to include/implement functions like:- Soap session handling for 8 basic quickbooks web connector operations: authenticate() clientVersion() closeConnection() connectionError() getLastError() getServerVersion() receiveResponseXML() sendRequestXML() -
How to filter out Friends of user in search users function Django
I'm trying to filter out the friends of a user and also the current logged in user from a "search_users" function, I've tried using exclude() but keep getting an error I'm not sure whats wrong. I also wanted to add a "add friend" button next to the users, which I think I've done correctly on 'search_users.html. Error views.py @login_required def search_users(request): query = request.GET.get('q') object_list = User.objects.filter(username__icontains=query).exclude(friends=request.user.profile.friends.all()) context ={ 'users': object_list } return render(request, "users/search_users.html", context) search_users.html {% extends "feed/layout.html" %} {% load static %} {% block searchform %} <form class="form-inline my-2 my-lg-0 ml-5" action="{% url 'search_users' %}" method="get" > <input name="q" type="text" placeholder="Search users.." /> <button class="btn btn-success my-2 my-sm-0 ml-10" type="submit"> Search </button> </form> {% endblock searchform %} {% block content %} <div class="container"> <div class="row"> <div class="col-md-8"> {% if not users %} <br /><br /> <h2><i>No such users found!</i></h2> {% else %} <div class="card card-signin my-5"> <div class="card-body"> {% for user_p in users %} <a href="{{ user_p.profile.get_absolute_url }}" ><img src="{{ user_p.profile.image.url }}" class="rounded mr-2" width="40" height="40" alt="" /></a> <a class="text-dark" href="{{ user_p.profile.get_absolute_url }}" ><b>{{ user_p }}</b></a > <small class="float-right"> <a class="btn btn-primary mr-2" href="/users/friend-request/send/{{ user_p.username }}" >Add Friend</a> </small> <br/><br /> {% endfor %} </div> </div> {% … -
Django Rest Framework custom POST URL endpoints with defined parameter
previously in Django 1.11, I'ved defined Django REST API in this way: in url.py url(r'^api/test_token$', api.test_token, name='test_token'), in api.py @api_view(['POST']) def test_token(request): # ----- YAML below for Swagger ----- """ description: test_token parameters: - name: token type: string required: true location: form """ token = request.POST['token'] return Response("test_token success", status=status.HTTP_200_OK) Now that I am migrating to Django 3.1.5, I'd like to know how the above can be achieved in the same way with Django Rest Framework (DRF). In the above particular case, it is POST API that takes in one parameter. (also if possible generate API documentation like swagger/redoc) -
Filter objects in a queryset by a boolean condition
I would like to filter objects in a Queryset according to a Boolean condition and can’t figure out the best way to do it. At the moment I have two models: class Language(models.Model): langcode = models.CharField(max_length=3, unique=True) Translated = models.BooleanField(default=False) class Countries(models.Model): countrycode = models.CharField(max_length=3, unique=True) spoken_languages = models.ManyToManyField(Language) Continent = models.CharField(max_length=50) This represents a table of unique languages and a table of unique countries. Many countries speak many different languages but not every language has been translated yet. What I would like now is a Countries queryset where only translated languages appear in the spoken language section. My ideas were to make a Countries model property “translated_languages” that updates automatically when a languages Translated is turned True. But I can't figure out how to make it behave like I want it too (auto update when language gets translated etc.). Second attempt was to filter it on a view level but here I failed again because I couldn’t figure out how to filter it for each Country individually and store it. Then I tried it on a template level but filter doesn’t work there. In the end, I would like to use the object in two template for loops: {% … -
should i use free version of mysql? [closed]
hi, i am trying to build a blog application in which users can post there images and anyone can view(instagram clone). just imagine on huge scale if everyday many users upload their photos and data , will the database get slow or lead to data failure, if so for huge application can we use standard free mysql or in this case should i purchase paid mysql in short if application is huge and active 24?7 can database handle this much of traffic in your oppinion if i am building huge application , interms of datastorage and transfer what should i do using django as framework and rest common languages -
Django Login Page Location
I am trying to include a simple Login page into my Django project, following these steps: https://learndjango.com/tutorials/django-login-and-logout-tutorial At some point I think I am mistaken when I locate the registration folder, which is inside the templates one. My project structure is now as follows: project project ... application ... templates registration login.html But it raises me an error when I try to load http://127.0.0.1:8000/accounts/login Using the URLconf defined in project.urls, Django tried these URL patterns, in this order: 1. application/ 2. admin/ The current path, accounts/login, didn't match any of these. It also raises me the same error when I locate the registration folder inside the application/templates one (which is what I've been using for other html files). In addition, there is a point in the tutorial saying that the URLs provided by auth are: accounts/login/ [name='login'] accounts/logout/ [name='logout'] accounts/password_change/ [name='password_change'] accounts/password_change/done/ [name='password_change_done'] accounts/password_reset/ [name='password_reset'] accounts/password_reset/done/ [name='password_reset_done'] accounts/reset/<uidb64>/<token>/ [name='password_reset_confirm'] accounts/reset/done/ [name='password_reset_complete'] But it seems Django is just looking at 1. application/ and 2. admin/ Any idea about why this is happening? -
I am trying to download Django-heroku. But I am getting this Error: pg_config executable not found., how to solve it?
(myvenv) (base) siddhants-MacBook-Air:personal-project siddhantbhargava$ pip install django-heroku Collecting django-heroku Using cached django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB) Requirement already satisfied: dj-database-url>=0.5.0 in ./myvenv/lib/python3.8/site-packages (from django-heroku) (0.5.0) Requirement already satisfied: whitenoise in ./myvenv/lib/python3.8/site-packages (from django-heroku) (5.2.0) Requirement already satisfied: django in ./myvenv/lib/python3.8/site-packages (from django-heroku) (2.2.17) Requirement already satisfied: pytz in ./myvenv/lib/python3.8/site-packages (from django->django-heroku) (2020.5) Requirement already satisfied: sqlparse>=0.2.2 in ./myvenv/lib/python3.8/site-packages (from django->django-heroku) (0.4.1) Collecting psycopg2 Using cached psycopg2-2.8.6.tar.gz (383 kB) ERROR: Command errored out with exit status 1: command: /Users/siddhantbhargava/personal-project/myvenv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2n/rlv6c5zn6cbggrbcw65fvbz40000gn/T/pip-install-8opynhmw/psycopg2_6f717d71852848bb86def529de299ce9/setup.py'"'"'; file='"'"'/private/var/folders/2n/rlv6c5zn6cbggrbcw65fvbz40000gn/T/pip-install-8opynhmw/psycopg2_6f717d71852848bb86def529de299ce9/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/2n/rlv6c5zn6cbggrbcw65fvbz40000gn/T/pip-pip-egg-info-q4d5yztd cwd: /private/var/folders/2n/rlv6c5zn6cbggrbcw65fvbz40000gn/T/pip-install-8opynhmw/psycopg2_6f717d71852848bb86def529de299ce9/ Complete output (23 lines): running egg_info creating /private/var/folders/2n/rlv6c5zn6cbggrbcw65fvbz40000gn/T/pip-pip-egg-info-q4d5yztd/psycopg2.egg-info writing /private/var/folders/2n/rlv6c5zn6cbggrbcw65fvbz40000gn/T/pip-pip-egg-info-q4d5yztd/psycopg2.egg-info/PKG-INFO writing dependency_links to /private/var/folders/2n/rlv6c5zn6cbggrbcw65fvbz40000gn/T/pip-pip-egg-info-q4d5yztd/psycopg2.egg-info/dependency_links.txt writing top-level names to /private/var/folders/2n/rlv6c5zn6cbggrbcw65fvbz40000gn/T/pip-pip-egg-info-q4d5yztd/psycopg2.egg-info/top_level.txt writing manifest file '/private/var/folders/2n/rlv6c5zn6cbggrbcw65fvbz40000gn/T/pip-pip-egg-info-q4d5yztd/psycopg2.egg-info/SOURCES.txt' Error: pg_config executable not found. pg_config is required to build psycopg2 from source. Please add the directory containing pg_config to the $PATH or specify the full executable path with the option: python setup.py build_ext --pg-config /path/to/pg_config build ... or with the pg_config option in 'setup.cfg'. If you prefer to avoid building psycopg2 from source, please install the PyPI 'psycopg2-binary' package instead. For further information please check the 'doc/src/install.rst' file (also at <https://www.psycopg.org/docs/install.html>). ---------------------------------------- ERROR: Command errored out with exit status 1: python … -
Using annotate() on top of django filters
Is it possible to use annotate on top of Django filters? I'm not referring to the filter() in the django documentation but django-filters. Something like this gave me an attributeerror to say that the filter does not have the attribute annotate post = postFilter(request.GET, queryset=BlogPost.objects.exclude((Q(author_id__in=request.user.blocked_users.all()) | Q(author = request.user))).order_by('date_updated')).annotate(user_has_interest=Case(When(interest__user=request.user, then=Value(True)), default=False, output_field=BooleanField())) -
Django 1.11 - make column foreign key without deleting
Previously we made integer field like: cart_id = models.IntegerField(_('cart_id'), null=True) But now I want to make this field foreign key: cart = models.ForeignKey(Cart, null=True, db_column='cart_id') The problem is that in the migration it generates two operations for deleting field and creating new one: operations = [ migrations.RemoveField( model_name='order', name='cart_id', ), migrations.AddField( model_name='order', name='cart', field=models.ForeignKey(db_column=b'cart_id', to='cart.Cart', null=True), preserve_default=True, ), ] Is there any way to make it as alter field? -
How to solve user updating problem in Django
I created a system with Django. I need user update section for this project. At the beginning of the project the user change form was working but now it doesnt work. I have a hiden field in my form and I think that's the problem but I'm not sure. Can you help me? view.py def update_user(request, id): user = get_object_or_404(UserProfile, id=id) form = SignUpForm(request.POST or None, request.FILES or None, instance=user) if form.is_valid(): form.save() return redirect('/') context = { 'form': form, } return render(request, "update_user.html", context) models.py class UserProfile(AbstractUser): ranks = ( ('Analyst', 'Analyst'), ... ('Chief Financial Officer', 'Chief Financial Officer'), ) comp_name = models.CharField(max_length=200, default='', blank=True, null=True) user_id = models.UUIDField(default=uuid.uuid4(), editable=False, unique=True) .... rank = models.CharField(max_length=200, choices=ranks) image = models.ImageField(upload_to='profile_image', blank=True, null= True, default='profile.png') def __str__(self): return self.username def get_unique_slug(self): slug = slugify(self.slug.replace('ı', 'i')) unique_slug = slug counter = 1 while UserProfile.objects.filter(slug=unique_slug).exists(): unique_slug = '{}-{}'.format(slug, counter) counter += 1 return unique_slug forms.py class SignUpChangeForm(UserChangeForm): class Meta: model = UserProfile fields = ( 'username', 'first_name', 'last_name', 'email', 'rank', 'comp_name', 'image' ) def clean_password(self): return self.clean_password update_user.html <form method="post"> {{ form|crispy }} {% if form.errors %} {% for field in form %} {% for error in field.errors %} <div class="alert alert-danger"> <strong>{{ … -
How to pass the value of ranges to my variable call?
Hello I'm using http://www.daterangepicker.com/ but in my case, I need to pass the string instead of dates. the default let dateDates is: let dateDates = start.format('YYYY-MM-DD') + ',' + end.format('YYYY-MM-DD'); but instead of getting http://127.0.0.1:8000/api/v1/test/?date_range=2021-01-26,2021-01-27 I need it like this. http://127.0.0.1:8000/api/v1/test/?date_range=Today because on my Django-REST API. it only accepts that way on date_range parameter. If there is an alternative please suggest. Thank you! let dateDates = `If I choose Today, I will get 'Today' not moment() values.`; let defaultUrl = `http://127.0.0.1:8000/api/v1/test/?date_range=${dateDates}`; updateValueForUrl(defaultUrl); $('#reportrange').daterangepicker({ startDate: start, endDate: end, ranges: { 'Today': ['Today'], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Last 7 Days': [moment().subtract(6, 'days'), moment()], } -
Which opensource dashboard library/tool would you recommend for implementation in Django project?
In my Django application I would like to implement analytics dashboard with configurable treeview, tables and charts for time series data (e.g. prices, electricity consumptions, …). For start I am planning to use some opensource library/tool. If anyone has idea/experience about this, please share your view. Thank you. Ivan -
TypeError: validate_action() takes 0 positional arguments but 2 were given
this is my code and i looks okay to me but i keep on getting the above error. Please i need your help def post_action(request, *args, **kwargs): serializer = PostActionSerializer(data=request.data) if serializer.is_valid(raise_exception=True): data = serializer.validate_data post_id = data.get("id") action = data.get("action") qs = Post.objects.filter(id=post_id) if not qs.exists(): return Response({}, status=404) obj = qs.first() if action == "like": obj.likes.add(request.user) elif action == "unlike": obj.likes.remove(request.user) elif action == "lift": pass return Response({"message": "Post deleted!"}, status=200) -
How can I access model fields linked to another model In Model.py?
I have following model Schedule, Booking and RoutePrice. Schedule Model: class Schedule(BaseModel): bus_company_route = models.ForeignKey(BusCompanyRoute, on_delete=models.PROTECT) bus = models.ForeignKey(Bus, on_delete=models.PROTECT) travel_date_time = models.DateTimeField() seat_discounted_price_for_travel_agent = AmountField(null=True, blank=True) seat_discounted_price_for_user = AmountField(null=True, blank=True) seat_discounted_price_for_foreigner = AmountField(null=True, blank=True) representative_name = models.CharField( max_length=20, null=True, blank=True ) seat_price_for_travel_agent = AmountField(null=True, blank=True) seat_price_for_user = AmountField(null=True, blank=True) seat_price_for_foreigner = AmountField(null=True, blank=True) And Schedule is Linked to BusCompany Route in Many to One Relation. So BusCompany route model is. class BusCompanyRoute(BaseModel): route = models.ForeignKey(Route, on_delete=models.PROTECT) shift = models.ForeignKey( Shift, null=True, blank=True, on_delete=models.PROTECT ) journey_length = models.TimeField(null=True) bus_company = models.ForeignKey(BusCompany, on_delete=models.PROTECT) and BusCompanyRoute is linked with Route Price in One to many Relation. RoutePrice Model is as. class RoutePrice(BaseModel): bus_company_route = models.ForeignKey(BusCompanyRoute, on_delete=models.PROTECT) bus_type = models.ForeignKey(Category, on_delete=models.PROTECT) seat_price_for_travel_agent = AmountField(null=True) seat_price_for_user = AmountField(null=True) seat_price_for_foreigner = AmountField(null=True, blank=True) Now I want to get seat_price_for_travel_agent in schedule 'save method()' From RoutePrice Model I have come upto here. How shall I get seat_price_for_travel_agent from RoutePrice in Schedule? def save(self, *args, **kwargs): seat_price_for_travel_agent = self.bus_company_route.routeprice_set Now I don't know how to proceed further. -
Responsive Rest api to find data type
I am trying to create List Create api to find Excel file data type and sheet name and number of rows. For this I have created a Model and serializer for file format, file path and file name to read excel using pandas. I have successfully get the data from user and stored to db. But I am stucking to post the output of datatype, sheetname and imported data. Request please give your suggestion. # views.py class FindDataTypeListCrtApi(ListCreateAPIView): queryset = FindDatatype.objects.all() serializer_class = FindDataTypeSerializer def find_datatype(self, *args, **kwargs): querylist = FileDatatype.objects.all() file_format = self.request.GET.get('filetype') file_dir = self.request.GET.get('filepath') file_name = self.request.GET.get('filename') HERE = os.path.abspath(os.path.dirname(__file__)) DATA_DIR = os.path.abspath(os.path.join(HERE, file_dir)) file_path = os.path.abspath(os.path.join(DATA_DIR, file_name)) if file_format == 'Excel': xl = pd.ExcelFile(file_data) sheet_name = xl.sheet_names data = pd.read_excel(file_data) data_type = data.dtypes return data_type elif file_format == 'CSV': data = pd.read_csv(file_data) data_type = data.dtypes return data_type elif file_format == 'JSON': data = pd.read_json(file_path) data_type = data.dtypes return data_type else: return "File Format Not Available...!" # Model.py class FindDatatype(models.Model): ftype = [('CSV','CSV'), ('Excel','Excel'), ('JSON','JSON')] filetype = models.CharField(max_length=10, choices=ftype, blank=True) filepath = models.CharField(max_length=250, blank=True) filename = models.CharField(max_length=50, blank=True) createdDate = models.DateTimeField(auto_now_add=True) # serializers.py class FindDataTypeSerializer(serializers.ModelSerializer): class Meta: model = FindDatatype fields = "__all__" I get following output … -
Store variables from original function to use in the celery task
I have a basic function in my views - def DoSomething(request): username = request.user.username email = request.user.email celery.delay() return render(request, "home.html") And then I want my celery task to send an email using the variables collected in the original function. I can't simply get the username and email from within the celery task as requests won't work. celery.py - @app.task(bind=True) def celery(self): send_mail( username, # subject 'my message here', # message myemail@myemail.com, # from email [email], #to email ) How can I pass these variables over as heroku won't let me push an import to the celery.py page but importing them? -
How to get data by status field in django rest framework
Actually I'm working on a project.I want to get data by status field which is created in models.py in Django rest framework. Here this is my scource code Models.py file class employee(models.Model): name = models.CharField(max_length=50) salary = models.IntegerField() phone = models.CharField(max_length=20) address = models.CharField(max_length=250) status = models.CharField(max_length=20) Views.py file class employeeviewset(viewsets.ModelViewSet): queryset = models.employee.objects.all() serializer_class = serializers.employeeserializer class employeebystatus(viewsets.ModelViewSet): def get(self, request, status): employee = models.employee.objects.filter(status=status) if employee: serializer = serializers.employeeserializer(employee, many=True) return Response(status=200, data=serializer.data) return Response(status=400, data={'Employee Not Found'}) Urls.pyfile router = routers.DefaultRouter() router.register('employee/<status>/', employeeviewset) How to get data by status field using queries can any one tell me the answer -
Django - Get objects from third model using foreignkey
I have Models. class M1(models.Model): .... class M2(models.Model): .... class M3(models.Model): n1 = models.ForeignKey( M1, related_name="M1_related", on_delete=models.CASCADE ) n2 = models.ForeignKey( M2, related_name="M2_related", on_delete=models.CASCADE ) In templates I have M1 object. Using it, I want to get all M2 objects related to M1 object. I tried {{M1_object.M1_related.n2.all}} but is blank. Doing {{M1_object.M1_related}} gives me M3.None I looked at these two questions 1 and 2. They are similar to mine but not helpful. -
Django/Digital Ocean space botocore.exceptions.ClientError: An error occurred () when calling the PutObject operation:
Hello I was following this tutorial: link and I got to the section of sending my static files to the DigitalOcean AWS3 space with boto3 and django-storages, however when I call the collectstatic function I get the following error. I am really with setting projects live: File "manage.py", line 22, in <module> main() File "manage.py", line 18, in main execute_from_command_line(sys.argv) File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv self.execute(*args, **cmd_options) File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute output = self.handle(*args, **options) File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 194, in handle collected = self.collect() File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 118, in collect handler(path, prefixed_path, storage) File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 355, in copy_file self.storage.save(prefixed_path, source_file) File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/django/core/files/storage.py", line 52, in save return self._save(name, content) File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/storages/backends/s3boto3.py", line 447, in _save obj.upload_fileobj(content, ExtraArgs=params) File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/boto3/s3/inject.py", line 619, in object_upload_fileobj return self.meta.client.upload_fileobj( File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/boto3/s3/inject.py", line 539, in upload_fileobj return future.result() File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/s3transfer/futures.py", line 106, in result return self._coordinator.result() File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/s3transfer/futures.py", line 265, in result raise self._exception File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/s3transfer/tasks.py", line 126, in __call__ return self._execute_main(kwargs) File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/s3transfer/tasks.py", line 150, in _execute_main return_value = self._main(**kwargs) File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/s3transfer/upload.py", line 692, in _main client.put_object(Bucket=bucket, Key=key, Body=body, **extra_args) File "/home/django/AgnieseMinimarkt/env/lib/python3.8/site-packages/botocore/client.py", line 357, in _api_call … -
How to filter web traffic on Google Analytics based on type of user login using Django Authorization
I have a website where I have three different login accounts on a Django site: admin, customers, and sellers. Right now, the traffic for all three accounts is being aggregated together on Google Analytics. Does anyone know how I can tag traffic from each of these accounts so I can filter on my Google Analytics account? My two guesses are: I render some type of profile name into the creation of the Google Analytics instance that would allow me to filter in Google Analytics: ga('create','UA-XXXXXXXX-X','{{ profile_type }}'); I create separate tracking IDs for each profile type and render those in depending on the account logged in. I don't necessarily want three different accounts on the Google Analytics side of things though, I just want to be able to filter between them. An example would be to insert this into the GA snipped when a user is logged in as an admin: ga('create','UA-{{admin_ga_tracking_code}}') Filtering by IP is not a solution because my admins and customers are all around the world and change. Thank you for any insight you can provide! -
how to share android(remote device) screen in web application using python?
We are developing fully controlled MDM(Mobile Device Management). Whenever an admin click on screen sharing then android(remote device) screen must be visible(remote access also may need in future) to an Admin. Admin functionalities developing in python using Django framework. how can I achieve this using python. Please suggest any other things to achieve this. Thanks -
Which of the following should I pay for to be able to create and deploy a commercial website?
I am planning to develop a website for city-wide commercial use. I am planning to use the following: FRONT-END (Atom Text Editor) -HTML -CSS -Javascript -jQuery -Bootstrap BACKEND -Python -Anaconda -Django -SQL Hosting -PythonAnywhere -GoDaddy Which of them should I pay for and how much will it cost me per year? And do you have any suggestions? Thanks in advance!