Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
wsgi : error Failed to exec Python script file
im trying to deploy a Django/React app in a VPS ubuntu server When I'm trying to access site, i receive this error in Apache: [Sat Aug 20 13:55:19.688413 2022] [wsgi:error] [pid 2672328] [remote 197.1.126.187:48890] Traceback (most recent call last): [Sat Aug 20 13:55:19.688510 2022] [wsgi:error] [pid 2672328] [remote 197.1.126.187:48890] File "/home/vshell/cleverSignal/backend/config/wsgi.py", line 12, in <module> [Sat Aug 20 13:55:19.688540 2022] [wsgi:error] [pid 2672328] [remote 197.1.126.187:48890] from django.core.wsgi import get_wsgi_application [Sat Aug 20 13:55:19.688655 2022] [wsgi:error] [pid 2672328] [remote 197.1.126.187:48890] ModuleNotFoundError: No module named 'django' [Sat Aug 20 14:10:32.319045 2022] [mpm_prefork:notice] [pid 2672327] AH00169: caught SIGTERM, shutting down [Sat Aug 20 14:10:32.469913 2022] [mpm_prefork:notice] [pid 2672623] AH00163: Apache/2.4.41 (Ubuntu) mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations [Sat Aug 20 14:10:32.469985 2022] [core:notice] [pid 2672623] AH00094: Command line: '/usr/sbin/apache2' [Sat Aug 20 14:27:08.420149 2022] [mpm_prefork:notice] [pid 2672623] AH00169: caught SIGTERM, shutting down [Sat Aug 20 14:27:08.562734 2022] [mpm_prefork:notice] [pid 2672816] AH00163: Apache/2.4.41 (Ubuntu) mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations [Sat Aug 20 14:27:08.562796 2022] [core:notice] [pid 2672816] AH00094: Command line: '/usr/sbin/apache2' [Sat Aug 20 14:27:58.149587 2022] [wsgi:error] [pid 2672817] [remote 197.1.126.187:48912] mod_wsgi (pid=2672817): Failed to exec Python script file '/home/vshell/cleverSignal/backend/config/wsgi.py'. [Sat Aug 20 14:27:58.149702 2022] [wsgi:error] [pid 2672817] [remote 197.1.126.187:48912] mod_wsgi … -
How to convert markdown to HTML and use it directly in a HTML file in Python
I'm new in programming and currently taking the CS50W, learning to use Django to build a dynamic website I'm using Python markdown library to convert the markdonw to HTML like below #in views.py import markdown def entry(request, entry): if entry not in util.list_entries(): return render(request, "encyclopedia/error.html", { "entry": entry }) return render(request, "encyclopedia/search.html", { "entry": entry, "content": markdown.markdown(util.get_entry(entry)) }) #in search.html {% extends "encyclopedia/layout.html" %} {% block title %} {{entry}} {%endblock %} {% block body %} {{content}} {% endblock %} but the HTML only display like this(please check the image below) then I use devtool to check the source code, found that there are " " cover my content, is there any way to remove the " "? enter image description here -
How change value in SQL Django without entering in redactor
As an example i have models like this: from django.db import models class Pos(models.Model): POS_TAGS = [ ('NOUN', 'NOUN'), ('ADJ', 'ADJ'), ('NUM', 'NUM'), ('PRON', 'PRON'), ('ADV', 'ADV'), ('VERB', 'VERB'), ('CNJ', 'CNJ'), ('ADP', 'ADP'), ('PRT', 'PRT'), ('INTJ', 'INTJ'), ('MOD', 'MOD'), ('IMIT', 'IMIT'), ('AUX', 'AUX'), ('PPN', 'PPN'), ('PUNC', 'PUNC'), ('SYM', 'SYM') ] token = models.CharField(max_length=150) pos = models.CharField(max_length=150, choices=POS_TAGS, null=True, default='NOUN') and some data in Pos model: then I want to change data without entering in redactor: like this: just change the value in the main page and press ok to save -
Django & Celery: How to start a thread in AppConfig() only once?
I have a Django app iot_app with Celery and Rabbitmq, where in an app called app_users a thread is started in AppConfig(): app_users/apps.py: def start_test_thread(): th = Thread(target=mqtt_test_function, args=(), daemon=True) th.start() class AppUsersConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" name = "app_users" def ready(self): run_once = os.environ.get('CMDLINERUNNER_RUN_ONCE') print(run_once) if run_once is not None: return os.environ['CMDLINERUNNER_RUN_ONCE'] = 'True' start_test_thread() As you can see, I check if an environment variable is set to start the thread only once. This works. The thread is started only once. The problem is that when I start Celery with the command celery -A iot_app worker -l info, the thread is started twice. How can I make the thread start only once even with Celery? -
CSRF_token is not valid in djnango Ajax multiple request from same page
I'm trying to perform a OTP-based login in my project. So I have a form with email and password field in the login form and when I submit it through AJAX request I check for the email and password in the database, if the values are correct then I will send an OTP through email and display a new OTP field on the same page for Entering the OTP for verifications. Till now everything is working fine but after entering the OTP when I try to re-submit the form, I got an error csrf_token is not valid. As far as I know csrf_token is only generated on page refresh or page load but in my case the first csrf_token that was generated on page load was used in first post request. So now how can I send the second post request with same csrf_token or can I generate the new csrf_token . Code snippets are as follows; <form id="loginForm" method="post" action="send_otp"> <div class="col-12"> <label class="text-16 lh-1 fw-500 text-dark-1 mb-10">Email</label> <input id="email" type="text" name="email" placeholder="Name"> </div> <div class="col-12"> <label class="text-16 lh-1 fw-500 text-dark-1 mb-10">Password</label> <input id="password" type="password" name="password" placeholder="Password"> </div> <div id="otp_field" class="col-12"> </div> <div class="col-12"> <button type="submit" name="submit" id="send_otp" class="button … -
how to save the data using django channel to postgresql
I'm trying to save the data that send using django channel and postgresql. consumers.py async def connect(self): event = eventhubreader.EventReader() async def cb(partition, events): data = events[len(events)-1] await self.send(json.dumps({'value': data.body_as_json()})) now = datetime.now() dataFormat = {"IotData": {"temperature": data.body_as_json()["temperature"], "humidity": data.body_as_json()["humidity"]}, "MessageDate": now.strftime("%d/%m/%Y %H:%M:%S"), "DeviceId": data.body_as_json()['deviceId']} saverecord = Rawdata() saverecord.ref_waterplant = random.randint(20, 25) saverecord.created_at = dataFormat['MessageDate'] saverecord.is_live = True saverecord.save() print(dataFormat) await self.accept() models.py class Rawdata(models.Model): ref_waterplant = models.CharField(max_length=100) created_at = models.DateField() is_live = True class Meta: db_table = "rawdata" error An error occurred while receiving. The exception is SynchronousOnlyOperation('You cannot call this from an async context - use a thread or sync_to_async.'). -
Why all my images, buttons are not the same with the same css in Django and simple site?
I had a Website made previously in Html&CSS and I wanted to make a Django project with this site. I created a django app, uploaded the html & css & some images and set up this static files dir how it's correctly. But Why all my images, buttons and different things are not the same like without Django? Django somehow take the css differently? -
Direct assignment to the forward side of a many-to-many set is prohibited. Use categories.set() instead
This is my model class Post(models.Model): title = models.CharField(max_length=100, blank=False, null=False) description = models.TextField(max_length=1000, blank=True, null=True) created_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='post_created_by') categories = models.ManyToManyField(to=Category, blank=True, related_name='categories') This is my serializers class CreatePostSerializer(ModelSerializer): categories = serializers.CharField(error_messages={'required': "categories can't be blank"}) title = serializers.CharField(error_messages={'required': "title can't be blank"}) description = serializers.CharField(error_messages={'required': "description can't be blank"}) class Meta: model = Post fields= ['title','description','categories'] def create(self,validated_data): title = validated_data['title'] description = validated_data['description'] categories = validated_data['categories'] user = self.context['request'].user if (title and description): post_obj = Post.objects.create( title=title, description=description, created_by=user, categories=categories) return validated_data This is my views class CreatePostAPIView(APIView): permisssion_classes = (IsAuthenticated,) def post(self,request,*args,**kwargs): user = request.user data = request.data serializer = CreatePostSerializer(data=data, context={'request': request}) if serializer.is_valid(): serializer.save() return Response({'success' :'True','message' : 'Post created successfully','data' : serializer.data},status=200) return Response(serializer.errors,status=400) When I try to hit the API endpoint then it gives me the following error: Direct assignment to the forward side of a many-to-many set is prohibited. Use categories.set() instead Please feel free to ask me anything. Any help please, Would be very appreciated. -
NoReverseMatch at /news/python-is-cool/
im new and i need your help, can anyone tell me what i did wrong? Reverse for 'post_detail' with keyword arguments '{'slug': 'python-is-cool'}' not found. 1 pattern(s) tried: ['(?P<category_slug>[-a-zA-Z0-9_]+)/(?P[-a-zA-Z0-9_]+)/\Z'] -
Django Excell structure
I need to make an webapp that is based on excell. There should be two kind of groups one for the user which can edit and view data and one for staff which can also create data to work for the user. Each of them have restricted view, user should only see their data while staff should see everything what every user had done or other staff member changed. I cant wrap my head around about those restrictions. my login is like that class Einloggen(LoginView): template_name = 'SCHUK/Einloggen.html' fields ='__all__' redirect_authenticated_user = True def get_success_url(self): if self.request.user.groups.filter(name='Personalverwaltung').exists(): return reverse('Dashboard') else: return reverse('Schulverzeichnis', args=[self.request.user.pk]) but when it comes to display data for the staff, there I hit a wall. class Dashboard (LoginRequiredMixin, ListView): model = SchulverzeichnisTabelle template_name = 'SCHUK/Dashboard.html' context_object_name = 'Dashboard' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['Schulverzeichnis'] = SchulverzeichnisTabelle.objects.all() return context while I can list everything with Foreignkeys the data that staff creates is not listed bc a foreignkey only show one entry when I use a mtm field I get this in my template <QuerySet []> reading docs and all you cant read individual entries from a mtm only what mtm has stored How can I show each … -
Python Django - Select Choice is not Valid
When i want to save the form on a new CharFields (with Choices), Django tell me that the Selec choice is not valid. I take another Choice list which work with another models, it's work normally. Models.py: class productsdefinition(models.Model): Products = models.CharField(max_length=Lenght200, default='NA') Status = models.CharField(max_length=Lenght10, choices=Utilities_CSP.PRODENG_CHOICES) Tester = models.ForeignKey(tester, on_delete=models.CASCADE, null=True) Board = models.ForeignKey(board, on_delete=models.CASCADE, null=True) TestProgram = models.CharField(max_length=Lenght200, default='') ProgramLoad = models.ForeignKey(ProgramLoad, on_delete=models.CASCADE, null=True) ListProgramEG = Utilities_CSP.ExtractProgEG() Probecard = models.CharField(verbose_name='Probe Card',max_length=Lenght200, choices=ListProgramEG, null=True) ProgramEG = models.CharField(verbose_name='Program EG',max_length=Lenght200, choices=ListProgramEG, null=True) forms.py: class ProducDefForm(forms.ModelForm): global tempfield i = 0 tempfield = [] for var in list(vars(productsdefinition()).keys()): if i <= 1: pass elif var == "Date_added": pass elif var == "LastModified": pass elif var.find("_id") != -1: var = var.replace("_id","") tempfield.append(str(var)) else: tempfield.append(str(var)) i = i + 1 class Meta: model = productsdefinition fields = tempfield def __init__ (self, *args, **kwargs): super(ProducDefForm, self).__init__(*args, **kwargs) ListProbecard = Utilities_CSP.ExtractProgEG() self.fields['Probecard'].choices = ListProbecard So my field ProgramEG work fine, when i try to put the list (of choice) to ensure that the field Probecard work, it don't work, it tell me "Select Choice in not valid,...." Do you have any idea where can be the erorr ? In the Table of the DB ? -
Django argument type not iterable?
My models.py: from django.db import models # Create your models here. class Day(models.Model): title = models.CharField(max_length=120) items = models.ManyToManyField('Excercise',related_name='days') def __str__(self): return self.title class Excercise(models.Model): name = models.CharField(max_length=200) reps = models.IntegerField(default=0) sets = models.IntegerField(default=0) def __str__(self): return self.name My serialisers.py class ExcerciseSerializer(serializers.ModelSerializer): class Meta: model = Excercise fields = '__all__' class DaySerializer(serializers.ModelSerializer): class Meta: model = Day fields = '__all__' my views.py : class ExcerciseView(ObjectMultipleModelAPIView, viewsets.ModelViewSet): serializer_class = ExcerciseSerializer def get_querylist(self,*args,**kwargs): querylist = Excercise.objects.filter() return querylist class DayView(ObjectMultipleModelAPIView, viewsets.ModelViewSet): serializer_class = DaySerializer def get_querylist(self,*args,**kwargs): querylist = Day.objects.filter() return querylist my urls.py router = DefaultRouter() router.register('Excercise',ExcerciseView,basename='Excercise') router.register('Day',DayView,basename='Day') urlpatterns = [ path('admin/', admin.site.urls), path('', include(router.urls)),] Please try to make it simple I am just starting out learning django so its a bit confusing It displays the error File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\drf_multiple_model\mixins.py", line 37, in check_query_data if key not in query_data: TypeError: argument of type 'Excercise' is not iterable. -
How to change the database name display in django admin site?
How to change the admin name and the database name in django admin site? -
Django Rest Framwork validate ListSerializer field from data received by form-data request
I am using Django and DRF to handle a restful backend. A request is sent that contains some fields and data (attached images). The request is received by a DRF serializer. I sent the request using form-data (via Postman). I received all fields and images properly except for a ListSerializer. The field is: class ListSerializerClass(serializers.Serializer): field_1 = serializers.IntegerField() field_2 = serializers.ListField(child=serializers.IntegerField(), min_length=1) class MainSerializerClass(serializers.Serializer): list_serialized_field = InputOfficeTaskTypeMap(many=True) normal_field = serializers.CharField(max_length=50) normal_field = serializers.CharField(max_length=50) Using Postman I send a list_serialized_field as a json: {"code": 123, "list_serialized_field": [{"field_1": 1, "field_2": [1,2]}, {"field_1": 2, "field_2": [2]}] Unfortunately, I could not received validated list_serialized_field and after calling serializer.is_valid, I got error that "list_serialized_field" is required. Is there any way to send json data and files in one request and validate them? P.S: I know that I can send form-data like below: list_serialized_field[0]field_2[0] but I want to send them in JSON format. -
Db error when cloning repository from github
I cloned the repository from github, activated the environment, but when I wrote the migration, appeared error. I tried fix her many times, but nothing worked. return Database.Cursor.execute(self, query, params) django.db.utils.OperationalError: no such table: api_secret models.py import datetime as dt import pgcrypto from django.db import models LIFE_TIME = ( #some code ) DATE_NOW = dt.datetime.now() TIME_OF_DEATH = { "1": (DATE_NOW + dt.timedelta(days=7)), "2": (DATE_NOW + dt.timedelta(days=3)), "3": (DATE_NOW + dt.timedelta(days=1)), "4": (DATE_NOW + dt.timedelta(hours=1)), "5": (DATE_NOW + dt.timedelta(minutes=30)), "6": (DATE_NOW + dt.timedelta(minutes=5)), } class Secret(models.Model): """The secret model contains all the information about the secret and its data""" secret = pgcrypto.EncryptedCharField("Secret", max_length=100000) key_word = pgcrypto.EncryptedCharField("Pass phrase", max_length=100) is_viewed = models.CharField("Already viewed", max_length=100) slug = models.CharField("Slug", max_length=20, unique=True) lifetime = models.PositiveIntegerField( verbose_name="Lifetime", null=True, blank=True, ) time_of_death = models.DateTimeField( "Secret end time", null=True, blank=True ) created_date = models.DateTimeField("Created date", auto_now_add=True) -
Trying to connect Django to MySQL. Connection error when migrating
I've been working for several weeks on Django. So far I have made 2 small projects. Now I tried to connect Django to the MySQL database. First, I started a new project. Then made a new app and updated the app in settings.py After that changed the database in the same file settings.py with my settings, Made a small model, Installed all the necessary aps, MySQLclient etc, Made the first migration successfully with 'Makemigration' So far so good! Next, I tried to make the second migration, as in the instructions. Then the error message appears: 'error 111, can't connect to database' Made some changes in the settings file, including SQL mode 'strict trans tables'. Now it shows me the error: Can't connect to local MySQL server through socket ... Missing file .sock. I looked up the directory and there was no such file. In the my.conf file the file is different!!! And exists! What is going on and what to do? -
How to legally protect myself from illegal files?
I understand this might not be the forum to ask this question but I'm trying to protect myself and other website users from illegal videos or files. I am doing a website and how do I check if the uploaded file contains any illegal stuff or adult content. Is there any API or service that does this. Also, how do I legally protect myself? Do I need to write something in the privacy policy and what sort of information do I need to collect from the users that upload files, is IP address enough or do I need email addresses as well? -
Create django project
I am new to programming I want to create django application in which user uploads a recipe. And for recipe they select the ingrident from the list and give the quantity of the ingrident. They should give multiple ingrident with quantity of every ingrident and a recipe name . And I also want to display the recipe with details -
This is the error that I am gettig TypeError: unhashable type: 'list'
What I want to do is, I want to create an endpoint through which I can upload a csv file with dataframes and I want to display these dataframes on my custom html format. But I am getting the error while sending file data from backend to frontend. Code def upload_files(request): form = UploadFileForm(request.POST or None, request.FILES or None) if form.is_valid(): csvfile = request.FILES['file_name'] data = pd.read_csv(csvfile.name) json_record = data.reset_index().to_json(orient='records') arr = [] arr = json.loads(json_record) context = {'d', arr} return render(request, 'upload.html', context) return render(request, 'record.html', {'form': form}) Error context = {'d', arr} TypeError: unhashable type: 'list' -
How to manage CORS in Django
Im trying to connect React.js[axios] and Django [hosting in Heroku] and every time I get this Ive allowed my host to connect but it doesn't work CORS_ALLOW_ORIGINS = [ 'localhost', 'https://itbookcom.herokuapp.com/' ] CSRF_TRUSTED_ORIGINS = [ 'localhost', 'https://itbookcom.herokuapp.com/' ] and here is react.js connection part constructor(props) { super(props); this.state = { bookList: [], error: null, }; } refreshList = () => { axios .get('https://itbookcombackend.herokuapp.com/api/books/') .then((res) => this.setState({ bookList: res.data })) .catch((err) => console.log(err)); }; componentDidMount() { this.refreshList(); } -
Parsing array of objects to Django backend from Ajax request
I have some data that I am gathering using JavaScript which I and trying to parse to my Django backend using an Ajax request. However the array is very different when console logging in the JavaScript and printing out in the python back end. JavaScript: function confirm_add_all_product(e) { let data_products = [] let table = e.closest("thead").nextElementSibling.childNodes table.forEach(function(i) { let row = {} row.record_id = (i.children[7].children[1].firstChild.getAttribute('data-record-id')) row.product_id = (i.children[7].children[1].firstChild.getAttribute('data-product-id')) row.foil = (i.children[2].textContent) row.condition = (i.children[3].textContent) row.language = (i.children[4].textContent) row.quantity = (i.children[7].children[0].value) data_products.push(row) }); console.log(data_products) $.ajax({ url: "/integrations/card/inventory_update_all/", type: "POST", data: { csrfmiddlewaretoken: csrf_token, data_products: data_products, }, success: function (response) {}, error: function (request, status, error) { console.log(error); } }); } Python: @login_required def inventory_update_all(request): print(request.POST) return HttpResponse(status=200) JS Console Log: [ { "record_id": "", "product_id": "", "foil": "false", "condition": "nm", "language": "eng", "quantity": "1" }, { "record_id": "", "product_id": "", "foil": "false", "condition": "nm", "language": "eng", "quantity": "2" } ] Current Python Print: <QueryDict: {'csrfmiddlewaretoken': [''], 'data_products[0][record_id]': [''], 'data_products[0][product_id]': [''], 'data_products[0][foil]': ['false'], 'data_products[0][condition]': ['nm'], 'data_products[0][language]': ['eng'], 'data_products[0][quantity]': ['1'], 'data_products[1][record_id]': [''], 'data_products[1][product_id]': [''], 'data_products[1][foil]': ['false'], 'data_products[1][condition]': ['nm'], 'data_products[1][language]': ['eng'], 'data_products[1][quantity]': ['2']}> Expected Python Print: <QueryDict: {'csrfmiddlewaretoken': [''], 'data_products': {['record_id': '', 'product_id': '', 'foil': 'false', 'condition': 'nm', 'language': 'eng', 'quantity': '1'],['record_id': '', 'product_id': … -
Django folder structure for created file, static? media? or another one?
I want to create the file(.wav) by django and let it be downloaded by user. Currently I create the file under /myproj/static directory. However it is mixed with the other jpg/img files, so,, it's not good design? then, I read the document about /myproj/media directory but it is said used for user upload files. So,,, how is the good directory design for server created file? Should I create such as /myproj/create_wav? but how can user access this url in template? Thank you for any idea or helps. -
Not getting the profile image from html form but other datas are getting
this is the profile model class Profile(models.Model): user=models.ForeignKey(User,on_delete=models.CASCADE) id_user=models.IntegerField() bio=models.TextField(blank=True) profileimg=models.ImageField(upload_to='profile_images',default='defaultdp.png') location=models.CharField(max_length=100,blank=True) def __str__(self): return self.user.username this is the html form <form action="" method="POST" enctype="multipart/form-data"> {%csrf_token%} <div class="col-span-2"> <label for=""> Profile Picture</label> <img height="100" width="100" src="{{user_profile.profileimg.url}}"> <input type="file" name="profileimg" placeholder="" class="shadow-none bg-gray-100"> </div> <form> this is views.py @login_required(login_url='signin') def settings(request): user_profile=Profile.objects.get(user=request.user) if request.method == 'POST': if request.FILES.get('image')==None: image=user_profile.profileimg bio=request.POST ['bio'] location=request.POST['location'] user_profile.profileimg=image user_profile.bio=bio user_profile.location=location user_profile.save() if request.FILES.get('image')!=None: image=request.FILES.get('image') bio=request.POST ['bio'] location=request.POST['location'] user_profile.profileimg=image user_profile.bio=bio user_profile.location=location user_profile.save() return redirect('settings') return render(request,'setting.html',{'user_profile': user_profile}) the profile image which I am getting is the defaultdp.png which is the default pic if no file is getting uploaded. I think the file i am uploading is not getting saved on the database or I dont know what is happening here. could anyone please help me to sort it out..? If I am missing any kind of code snippet here for debugging kindly mention it.I will edit the question with the mentioned code. -
Django - No module named 'mywebsite'
I have a django app that I downloaded from a Github repo where the main app is not called "mywebsite" (like instructed in the django tutorial). Everytime I run python manage.py runserver i get the following error. Conceptually I understand the error, but practically I don't. The issue can't be that I have always need to name my repo "mywebsite" right? This is the current repo structure. Traceback (most recent call last): File "/Users/nicolamacchitella/Documents/GitHub/familytree/.env/lib/python3.9/site-packages/django/core/management/base.py", line 402, in run_from_argv self.execute(*args, **cmd_options) File "/Users/nicolamacchitella/Documents/GitHub/familytree/.env/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 74, in execute super().execute(*args, **options) File "/Users/nicolamacchitella/Documents/GitHub/familytree/.env/lib/python3.9/site-packages/django/core/management/base.py", line 448, in execute output = self.handle(*args, **options) File "/Users/nicolamacchitella/Documents/GitHub/familytree/.env/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 81, in handle if not settings.DEBUG and not settings.ALLOWED_HOSTS: File "/Users/nicolamacchitella/Documents/GitHub/familytree/.env/lib/python3.9/site-packages/django/conf/__init__.py", line 92, in __getattr__ self._setup(name) File "/Users/nicolamacchitella/Documents/GitHub/familytree/.env/lib/python3.9/site-packages/django/conf/__init__.py", line 79, in _setup self._wrapped = Settings(settings_module) File "/Users/nicolamacchitella/Documents/GitHub/familytree/.env/lib/python3.9/site-packages/django/conf/__init__.py", line 190, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked ModuleNotFoundError: No module named 'mywebsite' During … -
Should i allow user to use the admin panel to upload his blog?
I'm building an app for someone, one of its function is it allowers the owner to upload blogs to the website. So i'm wondering if i should create a page for uploading blog or just give him staff permission so he can create and upload it through django's admin panel. I want to know if this is safe or if it will be worth it to create a front-end template for just one person to use.