Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
django giving Site errors after using django-allauth
I recently decided to add django-allauth to my application and it requires that I include 'django.contrib.sites' inside my settings.INSTALLED.APPS. This is causing my program to break with error Site matching query does not exist. I tried creating a new site and then using that site_id in my settings and that didn't solve the problem. -
Override the label and help_text attributes of the SetPasswordForm used by the PasswordResetConfirmView in Django
I'm using the built in PasswordResetConfirmView view, which subclasses the SetPasswordForm form but I don't know how to edit the label and help_text attributes on any of the fields in the SetPasswordForm form. I was able to change the label and help_text attributes of the fields in the PasswordChangeView view by doing the following: class CustomPasswordChangeView(PasswordChangeView): def get(self, request): form = self.get_form() form.fields['old_password'].label = 'Current password' form.fields['old_password'].help_text = 'Please enter your current password' return render(request, 'registration/password_change_form.html', {'form': form}) However, when I try the same thing with the PasswordResetConfirmView I get infinite errors. Firstly, it doesn't like the token and uidb64 keyword arguments being passed to the get() method from by following URL: r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$' I get the following errors: TypeError at /accounts/reset/MQ/set-password/ get() got an unexpected keyword argument 'uidb64' TypeError at /accounts/reset/MQ/set-password/ get() got an unexpected keyword argument 'token' My get method looks like this def get(self, request, uidb64, token) and the PasswordResetConfirmView view doesn't have a get_form() method so I'm stuck on how to access the form in my view. Everything else I've tried has failed as well but I think I'm probably taking the wrong approach here. Can anyone point me in the right direction please? -
Downloading sqlite3 in virtualenv
I'm trying to create app using the command python3 manage.py startapp webapp but i'm getting an error that says: django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3' So I tried installing sqlite3 using pip install sqlite3 but I got this error: Using cached sqlite3-99.0.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-dbz_f1ia/sqlite3/setup.py", line 2, in raise RuntimeError("Package 'sqlite3' must not be downloaded from pypi") RuntimeError: Package 'sqlite3' must not be downloaded from pypi Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-dbz_f1ia/sqlite3/ I tried running this command: sudo apt install sqlite3 but it says sudo is not a valid command, even apt isn't for some reason. I'm running Python3.6.2. I installed Python on my Godaddy hosting and i'm using SSH to install everything. I installed Python and setup a virtualenv. Afterwards, I installed Django and created a Django project. How can I fix these errors to successfully create a Django app? -
How to do statements with time value
In my Django python code I want to greet the visitor according to the time of the day. It always gives back 'Good afternoon'(even though it isn't) but can't see why. this is from my views.py: #import time #import datetime #from time import strftime #from django.utile import timezone def greet(request): request.session['greet'] = 'Good day' currentTime = time.strftime('%H') int(currentTime) if currentTime < 12 : request.session['greet'] = 'Good morning' if currentTime >= 18 : request.session['greet'] = 'Good afternoon' else : request.session['greet'] = 'Good evening' return request.session['greet'] -
Why does this loop take 5 seconds to execute in the django server but only 0.8 in the shell?
I'm trying to figure out a timing discrepancy in my python django project. When I run the function in the shell, it only takes about a second to get the return object and return it. When I run it by using an api call the timing says it takes over 5 seconds to loop through and serialize the objects. Below is the function in question: def serialize_particular(id=-1, all_available=False, page=0, maxOn=40): if id != -1: b = MyModel.objects.filter(id=id) if len(b) == 0: return [] else: b = b[0] data = [] if all_available: oThings = b.things else: oThings = b.things_available count = len(oThings) start = maxOn * page end = start + maxOn if start > count: oThings = oThings.filter(id=-1) nextPage = -1 else: if end > count: end = count page = -2 oThings = oThings[start:end] nextPage = page + 1 for inv in oThings: data.append({}) data[-1]['id'] = inv.id data[-1]['available'] = inv.available data[-1]['integer'] = inv.integer data[-1]['subObject'] = {} data[-1]['subObject']['name'] = inv.subObject.name data[-1]['subObject']['category'] = inv.subObject.category data[-1]['subObject']['subcategory'] = inv.subObject.subcategory data[-1]['subObject']['listOfSubs'] = [] for subsub in inv.subObject.listOfSubs.all(): data[-1]['subObject']['listOfSubs'].append({}) data[-1]['subObject']['listOfSubs'][-1]['name'] = subsub.name data[-1]['subObject']['listOfSubs'][-1]['category'] = subsub.category data[-1]['subObject']['listOfSubs'][-1]['subcategory'] = subsub.subcategory return data, nextPage Below is my timing function that I use in the server: class Timing: … -
Django Login Form Submit Refreshing Page
I want to display an error in a bootstrap modal when a user submits an incorrect login form. Right now, the submitting the form just reloads the current page so I can't get the JSON response. basic.html where the login modal appears ... <button type="button" class="btn btn-secondary btn-sm" data-toggle="modal" data-target="#loginModal" id="login_modal_trigger">Log In</button> {% include 'registration/login.html' with form=form %} ... registration/login.html <div class="modal fade" id="loginModal" tabindex="-1" role="dialog" aria-labelledby="loginModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Log In</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> <div id="content-container" class="container p-none"> <div class="lgn-container col-lg-8"> <form id="login-form" method="post" action=""> {% csrf_token %} <table class="table"> <tr> <td><label for="id_username">Username</label></td> <td><input id="id_username" name="username" type="text" class="form-control"></td> </tr> <tr> <td><label for="id_password">Password</label></td> <td><input id="id_password" name="password" type="password" class="form-control"></td> </tr> </table> {% if form.errors %} <p class=" label label-danger"> Your username and password didn't match. Please try again. </p> {% endif %} <input type="submit" id="ajax_form_submit" value="Login" class="btn btn-primary pull-right" /> </form> </div> </div> </div> </div> </div> </div> script.js: I figured event.preventDefault(); would prevent refreshing when there is an error. $(document).ready(function() { $("#login-form").submit(function(event) { jQuery.ajax({ "data": $(this).serialize(), "type": $(this).attr("method"), "url": "{% url 'login_user' %}", "success": function(response) { // switch(response.code) { // // Do what you want with … -
Django Python base.html for all templates
In my root directory i have a template and inside that template follow by a base.html that would be my main layout for my custom admin site. in my templates/admin/base.html I have this code. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Layout Page</title> </head> <body> {% block content %} {% endblock %} </body> </html> I want this base.html to be present in all my app templates. I have a app users in my mysite project that its the index.html page. inside my users/views. from django.shortcuts import render def index(request): return render(request, 'users/index.html') inside my templates/users/index.html I have this. {% extends "admin/layout.html" %} {% block content %} <h1>Hello World</h1> {% endblock %} I get an error that "TemplateDoesNotExist at /" I come from a node.js background so I have no idea if if this is even a good practice. I have came across many tutorials explaining the use of templates inside an app but non explaining outside the app. My understanding was that django bundle all templates into one. Thanks in advance. -
Error: 'Apps aren't load yet' when i try to import a model from another python project
I need to use a model from another python project to store data in django database. So, a create an another python file, which runs continuously, inside directory of other django files. The files structure are show bellow ProjectFolder WebSite operation urls.py views.py models.py admin.py apps.py db.sqlite3 manage.py pythonserver.py In my pythonserver.py i try to do: import os, sys if os.environ.setdefault('DJANGO_SETTINGS_MODULE','WebSite.settings'): from WebSite.operation.models import Registers else: raise sys.exit(1) The execution returns: "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. I'm using django 1.11 What is wrong? What the best pratice to use a model from other python file/project? Thanks a lot! -
Django 1.11 'method' object is not subscriptable (Form / Model)
Guys I am stuck on this problem for two days now, and I would really appreciate to get some help. I am trying to create an upload field where people can upload their CV/Resume. When I click on the 'submit' button I get the following error: Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/usr/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python3.5/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view return view_func(*args, **kwargs) File "/usr/local/src/project/views.py", line 160, in careersView applicant_cv = applyModel(cv = request.FILES.get['cv']) TypeError: 'method' object is not subscriptable I am using the following config (Django 1.11, testing with the build-in webserver, debug enabled): Models.py from django.db import models class applyModel(models.Model) : cv = models.FileField(upload_to='cvs/') Forms.py from django import forms from django.forms import ModelForm from .models import applyModel class applyForm(forms.Form) : name = forms.CharField(label="", required=True, max_length=50, widget=forms.TextInput(attrs={'placeholder': 'Your Name', 'class': 'name'})) email = forms.EmailField(label="", required=True, max_length=100, widget=forms.EmailInput(attrs={'placeholder': 'E-mail Address', 'class': 'email'})) phone = forms.CharField(label="", required=False, max_length=20, widget=forms.NumberInput(attrs={'placeholder': 'Phone Number', 'class': 'phone'})) linkedin = forms.CharField(label="", required=True, max_length=100, widget=forms.TextInput(attrs={'placeholder': 'LinkedIn / Professional Website', 'class': 'linkedin'})) portfolio = forms.CharField(label="", required=False, max_length=100, widget=forms.TextInput(attrs={'placeholder': 'Portfolio', 'class': 'portfolio'})) … -
Error loading Product Image
I have created a product_view page of an e-commerce project and I am trying to access some items on a page with its details. When the page loads, I only the name of the image of the item and not the image itself. Here is a screenshot : Here is my settings.py """ Django settings for shoppingmall project. Generated by 'django-admin startproject' using Django 1.11.1. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TEMPLATE_DIR = os.path.join(BASE_DIR,'templates') STATIC_DIR = os.path.join(BASE_DIR,'static') MEDIA_DIR = os.path.join(BASE_DIR,'media/') # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'jn^sgbwcco=!w9=h11_m2cvb727#k2w&$jb6w^68xldcr3l$jl' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] CART_SESSION_ID = 'cart' # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.sites', 'registration', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'shop', 'cart', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'shoppingmall.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [TEMPLATE_DIR, ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ … -
Django migrations being ran in test_ database even with migrations tuned off in the Settings file
In Django, I want Migrations to not run while unit testing, or anywhere really. In the Settings.py I have the following # Turn off all migrations MIGRATION_MODULES = { app[app.rfind('.') + 1:]: None for app in INSTALLED_APPS } If I now run python manage.py runserver with a fresh db it's completely empty. If I run python manage.py test the test_* database it creates has the basic migrations applied. I'm pretty confused, so any help as to what this might be or where to start looking would be much appreciated. -
Using Peaks.js (npm) in my Django project with django-bower
So Ive been trying to build an audio editor where users can edit their uploaded audio files, and so far I've stumbled upon thispeaks.js As the best option for doing that in the browser. I've never used npm in a django app, and realized I'd have to use something like Bower to manage the node module. So I'm trying to use Django Bower To manage the module. Here are my settings.py: STATIC_URL = '/static/' MEDIA_URL= '/media/' STATIC_ROOT = os.path.join(BASE_DIR,'static/') MEDIA_ROOT= os.path.join(BASE_DIR,'media_cdn') BOWER_COMPONENTS_ROOT = os.path.join(BASE_DIR, 'components') BOWER_INSTALLED_APPS = ( 'peaks.js', ) Ok so I've followed the django-bower instructions, and installed peaks.js with python manage.py bower install peaks.js. Now I'm looking back at the peaks.js documentation, and I can't figure out how to use Peaks, having tried the suggested ways of loading the module into the template. Anyone know where I'm going wrong? Is there a better/simpler way of going about it? -
How to export a Django model including ForeignKey model relationships into a combined text file
I have a Django model that has several ForeignKey model relationships that I need to combine into single records. If you look at my plaque model below, you'll notice I have a ForeignKey relationship to a veteran model. I created a veteran model without truly thinking it through and now need to add the veteran fields to my plaque model, but need to export all the data first, rebuild my plaque model, then re-import the data. I've have django-import-export installed and it works great for single models. I exported my plaque data and in the veteran field it just adds the id number of the related veteran. What I'd like to do, if possible, is actually export my plaque model and instead of the related veterans id number, the actual data from the veteran models(first_name, last_name etc). I am also using PostgreSQL if that helps. Any ideas? Thank you. class Plaque(models.Model): created_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='plaques', default=1) group = models.ForeignKey(Group, blank=True, null=True, verbose_name='Group Name') veteran = models.ForeignKey(Veteran, blank=True, null=True) ... -
How to properly configuring django-subdomains and resolve the subdomains in urlpatterns?
I'm using django-subdomains package in my project to assign certain apps to appropriate subdomains. However I'm having difficulties setting up this package and apps to be displayed in those subdomains. Let's call my project "MyProject", here's what I've done so far: in procjets settings.py I have: MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'subdomains.middleware.SubdomainURLRoutingMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'myproject.urls' SITE_ID = 1 SUBDOMAIN_URLCONFS = { None: 'myproject.urls', 'www': 'myproject.urls', 'manager': 'manager.urls', # I also tried: # 'manager': 'myproject.urls.manager' } In my projects urls.py I have: urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^manager/', include(manager_urls, namespace='manager'), name='manager'), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) And finally in my managers urls.py I have: from .views import home urlpatterns = [ url(r'^$', home, name='home'), ] Trying to access manager.myproject.com only show's up my hosts "nothing to see here yet" page. Couple things I don't quite grasp. First, in the documentation example of SUBDOMAIN_URLCONFS it is not clear to me in 'myproject.urls.frontend', what exactly is being requested using frontend? This might be where I'm making an error. Second, while the documentation shows how to get to sudomain using views and templates, it does not show an example of how to actually utilize this in URL patterns. I've … -
django migration doesn't automatically recognize the added fields using add_to_class()
I've created a subclass for reusable-package.models.Topic in my-project but the related models (those having a FK to Topic) are still referencing reusable-package.models.Topic. So as a solution for that is to subclass all models of reusable package (those having a FK to Topic) and make the explicit reference to the new model tried to fix that using add_to_class to add field instead of using inheritance the added code is the following: Topic.add_to_class('color', models.CharField(max_length=7, null=True, blank=True, help_text=_('HEX Color code'))) but the automatic migration doesn't recognize the added fields so i should manually create the migrations ./manage.py makemigrations regards, -
Django - Button for attending events?
I'm relatively new to Django. I am currently making a website for a small student association (approx. 100 people) and trying to make an event app on my website so that admins can create events, which users can choose to attend. I have successfully created the Models and used ListView and DetailView so that users can see which events are available. I'm having a problem making a button on the event detail page so that users can say whether they're attending the event with the click of a button. I am currently only able to do this through the admin site, but I want users to sign up themselves. As I understand I need to use some kind of a form, but I'm not sure how it is best to do this. It sounds simple, but I haven't been able to figure it out despite searching the web for a few days. As I say, I'm new to Django. I have two models, one for the events and one for the registrations, which links the users to the events and has information on when the users registered. Here are my files: Models.py import datetime from django.db import models from django.contrib.auth.models … -
Django - converting object to queryset without querying database
It often happens in my Django code that I have to make some operations with an object and then pass it on to other function in a form of a queryset. For now, I take the id of the object and query the database, which seems like junk code since I already have all data. Better illustrated by an example: obj = MyModelSerializer(data) obj.save() qs = MyModel.objects.filter(id = obj.id).values() # queries db just to get a queryset representation of a single object return render(request, 'test.html', {'qs': qs}) Is there any better way to overwrite this code? Or it is perfectly ok ? -
Does python social auth require sticky session?
I'm encountering fairly frequent exceptions from python social auth of the types: AuthMissingParameter & AuthStateMissing We're adding a SocialAuthExceptionMiddleware class to gracefully handle these but given the frequency I'm curious if our AWS load balancing without sticky sessions is contributing to the frequency of the exceptions? Thanks in advance for any guidance. Mike -
Check if a product belongs to a user?
In Django, what is the best option to check if a product belongs to a user? I usually use this one: def deleteProduct(request, pk): product= get_object_or_404(Product, pk=pk) if product.user.id == request.user.id: product.deleted=True product.save() else: raise PermissionDenied -
Django: running queries on resulting union query
Is there a way of writing this raw query using Django's ORM? I am trying to avoid using a raw query, because I would like to run additional filters on the resulting query. SELECT result.id, max(result.submit_date) submit_date, FROM ( (SELECT table_A.submit_date, table_A.id, FROM table_A INNER JOIN table_B ON (table_A.domain_id = table_B.id) WHERE (table_B.company_id = 3 AND table_A.deleted = FALSE)) UNION (SELECT (time) AS submit_date, (table_C.table_A_id) AS id, FROM table_C INNER JOIN table_A ON (table_C.table_A_id = table_A.id) WHERE (table_C.verb_type IN (8, 9, 14) AND table_C.company_id = 3 AND table_A.deleted = FALSE) ) ) result GROUP BY result.id ORDER BY 2 DESC; -
"$python manage.py runserver" not working. Only "python3 manage.py runserver"
I have been working through the initial tutorial and ran into a load of issues with my anaconda install using python 2.7. In the end it wouldn't launch the server. Anyway, I decided to change up on my machine to python3. That said, I am now getting strange results which are: If I use the terminal command $python -m django --version I get the following: "../Contents/MacOS/Python: No module named django" If I change to "$python3 -m django --version" terminal gives me back: "1.11.4" Now, when I am in the tutorial and starting again from the beginning I do the following: "$django-admin startproject mysite" This seemed to work. However, when I tried: "$python manage.py runserver" I get the following: Traceback (most recent call last): File "manage.py", line 17, in "Couldn't import Django. Are you sure it's installed and " ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment? If I change to include 3, so "$python3 manage.py runserver" all is well. My question is do I need to always use python3 in every command now? I does not say that in the tutorial. My Mac OSx … -
How to Open/Read Uploaded CSV Files in Views
I have a model named source where files are uploaded to, that looks like this: class Source(models.Model): file = models.FileField() name = models.CharField(max_length=255) def __str__(self): return self.name and I can call it easily in views like so: def source_details(request, source_id): context_dict = {} data_source = Source.objects.get(id=source_id) context_dict['data_source'] = data_source Additionally here are my urls: url(r'^source/(?P<source_id>[\w\-]+)/$', views.source_details), I want to open the csv file that the view is getting so I can loop through each line and display it in a table, any ideas on how I can accomplish this? -
CSV file upload from buffer to S3
I am trying to upload content taken out of a model in Django as a csv file. I don't want to save the file locally, but keep it in the buffer and upload to s3. Currently, this code does not error as is, and uploads the file properly, however, the file is empty. file_name='some_file.csv' fields = [list_of_fields] header = [header_fields] buff = io.StringIO() writer = csv.writer(buff, dialect='excel', delimiter=',') writer.writerow(header) for value in some_queryset: row = [] for field in fields: # filling in the row writer.writerow(row) # Upload to s3 client = boto3.client('s3') bucket = 'some_bucket_name' date_time = datetime.datetime.now() date = date_time.date() time = date_time.time() dt = '{year}_{month}_{day}__{hour}_{minute}_{second}'.format( day=date.day, hour=time.hour, minute=time.minute, month=date.month, second=time.second, year=date.year, ) key = 'some_name_{0}.csv'.format(dt) client.upload_fileobj(buff, bucket, key) If I take the buffer's content, it is definitely writing it: content = buff.getvalue() content.encode('utf-8') print("content: {0}".format(content)) # prints the csv content EDIT: I am doing a similar thing with a zip file, created in a buffer: with zipfile.ZipFile(buff, 'w') as archive: Writing to the archive (adding pdf files that I am generating), and once I am done, I execute this: buff.seek(0) which seems to be necessary. If I do a similar thing above, it will error out: Unicode-objects … -
Not Null constraint failed on Nested serializer due to "unable do get repr for QuerySet class" error
Trying to get basic Messaging functionality working in my DRF project. I seem to have a problem with the nested serializer validation. I'm new to DRF and have been reading the docs for a few days but I must have missed something. The error happens inside the line message = Message.objects.create(**validated_data) in my serializer.The request returns an Integrity error, NOT NULL constraint failed on accounts_message.sender_id, but through debugging I have found that this is caused by an error in query.py in the QuerySet method : self: unable to get repr for <class 'django.db.models.query.QuerySet'> model: <class 'accounts.models.Message'> query: none using: none This seems to be whats causing my issue, since the dict generated by the serializer seems to have all of the data thats being passed in the request, including the supposed null sender_id. However, I am not sure how to fix this issue. Do I need to override repr? or Query Set? This feels like im stuck on something relatively simple. Serializers.py class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ('id', 'name', 'email') extra_kwargs = { 'id': { 'validators': [UnicodeUsernameValidator()], } } class MessageSerializer(serializers.ModelSerializer): sender = UserSerializer() recipients = UserSerializer(many=True) class Meta: model = Message fields = ('id', 'subject', … -
Run Scrapy through Django View
So, I am working on the following project: I am using Django to develop a website that will work as a remote manager of a web crawler. To be more specific, I've created a spider with Scrapy that downloads some PDF files from another website. My goal is to find a way to call the spider via a POST (I guess) request and have the crawler running through my Django view. The files that are downloaded will be stored to the server that has the website running, not to the personal computer of anyone who runs the spider. So when I log into my website and press the Crawl button, the new files get downloaded into the server's file library. I am fairly new to Django and Scrapy so I have no clue how to make them work together to achieve what I am looking for, can someone guide me to a direction? I've seen some questions regarding running Scrapy scripts through other Python scripts but I do not understand how to connect them, where to put the Scrapy project files etc. Thank you for your time, I hope I didn't confuse you!