Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to prevent deletion of Django model from Django Admin, unless part of a cascade
I have a project using Django 2.2.4. I have a Django model called Company. I use a post_save signal to make sure that as soon as a new Company is created, a new model instance called "Billing" is created, which is associated with that Company. This contains the company's billing information. This works great. Since my Billing object is associated with a Company, and I use on_delete=models.CASCADE, as soon as the Company is deleted, the Billing object associated with that company is automatically deleted as well. This works great too. Since the Billing object for each company is now automatically created and deleted along with the Company, there's no need for admins using the Django Admin web interface to ever have to manually create, or delete Billing objects. I want to hide this functionality from them. Normally, the common way to prevent Django Admin from allowing someone to add or delete an object is by adding this to that model's ModelAdmin in admin.py: class BillingAdmin(admin.ModelAdmin): ... # Prevent deletion from admin portal def has_delete_permission(self, request, obj=None): return False # Prevent adding from admin portal def has_add_permission(self, request, obj=None): return False This works, and does indeed hide the ability for Admins … -
Why am I getting an error SyntaxError: unexpected EOF while parsing whereas I did not get it before
I am at the beginning of my project, I a priori finished the first feature (registration), and my site has already worked without error. But since this morning, it appears an error (it seems to me of syntax) that had never appeared before. Would it come from an update? Yet I did not do it voluntarily. The error : (venv) D:\Users\Robin\Documents\programmation\RepertoireGit\MaisSemence82\MaisSemence82>manage.py runserver Watching for file changes with StatReloader Performing system checks... Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Users\Robin\AppData\Local\Programs\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner self.run() File "C:\Users\Robin\AppData\Local\Programs\Python\Python36\lib\threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "D:\Users\Robin\Documents\programmation\MaisSemence82\venv\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper fn(*args, **kwargs) File "D:\Users\Robin\Documents\programmation\MaisSemence82\venv\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run self.check(display_num_errors=True) File "D:\Users\Robin\Documents\programmation\MaisSemence82\venv\lib\site-packages\django\core\management\base.py", line 390, in check include_deployment_checks=include_deployment_checks, File "D:\Users\Robin\Documents\programmation\MaisSemence82\venv\lib\site-packages\django\core\management\base.py", line 377, in _run_checks return checks.run_checks(**kwargs) File "D:\Users\Robin\Documents\programmation\MaisSemence82\venv\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "D:\Users\Robin\Documents\programmation\MaisSemence82\venv\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config return check_resolver(resolver) File "D:\Users\Robin\Documents\programmation\MaisSemence82\venv\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver return check_method() File "D:\Users\Robin\Documents\programmation\MaisSemence82\venv\lib\site-packages\django\urls\resolvers.py", line 398, in check for pattern in self.url_patterns: File "D:\Users\Robin\Documents\programmation\MaisSemence82\venv\lib\site-packages\django\utils\functional.py", line 80, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "D:\Users\Robin\Documents\programmation\MaisSemence82\venv\lib\site-packages\django\urls\resolvers.py", line 579, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "D:\Users\Robin\Documents\programmation\MaisSemence82\venv\lib\site-packages\django\utils\functional.py", line 80, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "D:\Users\Robin\Documents\programmation\MaisSemence82\venv\lib\site-packages\django\urls\resolvers.py", line 572, in urlconf_module return … -
pass value from PHP to Django
I have a PHP login page which authenticates the user and redirect the user to Django application but I need to post the username to Django application to know which user has logged in. I have tried to pass the user name as variable from PHP application and I have a get method but it's not the right way as the user can access the application just by changing username to some dummy name in the URL. PHP redirection: header("location: http://192.168.113.75:9200/NewHandBook/login?user=".$Username); Django get method: def login(request): userName = request.GET.get("user") print("Login user" + userName) return render(request, 'login/login.html', userName) -
django annotate with queryset
I have Users who take Surveys periodically. The system has multiple surveys which it issues at set intervals from the submitted date of the last issued survey of that particular type. class Survey(Model): name = CharField() description = TextField() interval = DurationField() users = ManyToManyField(User, related_name='registered_surveys') ... class SurveyRun(Model): ''' A users answer for 1 taken survey ''' user = ForeignKey(User, related_name='runs') survey = ForeignKey=(Survey, related_name='runs') created = models.DateTimeField(auto_now_add=True) submitted = models.DateTimeField(null=True) # answers = ReverseForeignKey... So with the models above a user should be alerted to take survey A next on this date: A.interval + SurveyRun.objects.filter( user=user, survey=A ).latest('submitted').submitted I want to run a daily periodic task which queries all users and creates new runs for all users who have a survey due according to this criteria: For each survey the user is registered: if no runs exist for that user-survey combo then create the first run for that user-survey combination and alert the user if there are runs for that survey and none are open (submitted__isnull=False) and the latest one's submitted date plus the survey's interval is <= today, create a new run for that user-survey combo and alert the user Ideally I could create a manager method … -
Resolving "No Space left on device"
I have my static and Django code on two different repositories on Gitlab. When I try combining the compiled static part of the code in the Django repository it throws an error as shown in the text below. Of the following alternatives which option seems a viable option to overcome the problem? "failed to copy files: failed to copy directory: Error processing tar file(exit status 1): write /.git/objects/pack/pack-a42ec8dc61ada625e41971a2b654253ecd85bc3d.pack: no space left on device" Option 1: Bind Mount the compiled static components on the django container. Option 2: Put up all the media files of the project(which approximate close to 70% of the compiled static files) on cloud and replace links in code thereby reducing the size of the project. Please let me know if any other alternatives work better as well. -
hhtp timeout even after making a server call ( ajax call ) every 3 mins (180 sec) to have server respond and keep the http connection alive
i am working on a django application currently deployed on azure app service.i includes generation of report in docx. format. in some scenerios i takes upto 5-6 minutes. at first i encountered activity timeout after 70 sec which i solved by using applicationHost.xdt to configure activitytimeout and request timeout. then another timeout happened after 230 sec almost. which according to my knowledge is due to load balancer. i understand it is not configurable in app service.. do i tried another technique which basically does is that it keeps pinging backend from client after every 180 sec. but the problem didn't go away. pasting detailed code below. Thanks in advance function pinger(stop) { if (status == true) { return; } else { $.ajax({ async : false, url:"{% url 'DummyUrl' %}", type: "GET", data: {}, beforeSend:function() { console.log('starting dummy') }, success:function(response){ console.log('success dummy') console.log(response.data) }, complete:function(){}, error:function (xhr, textStatus, thrownError){} }); return; } } function generate_report() { var status = false; $.ajax({ async : true, url:"{% url 'GenerateReport' %}", headers: { "X-CSRFToken": '{{csrf_token}}' }, type: "POST", data: {}, beforeSend:function() { console.log('starting'); console.log('readonly'); }, success:function(response){ if (response.data.toString().includes('.docx')) { console.log(response); var url_mask = "{% url 'download report' filename=12345 %}".replace(/12345/, response.data.toString()); console.log('document generated successfully here … -
Printing to console in Pycharm Django views.py
I am new to Pycharm (v2019.2) and Django (2.2.4). I am trying to understand pieces of code in various files and am trying to print data to the windows at the bottom of Pycharm, i.e. Run, manage.py, Terminal, Python Console. I've tried various solutions. I've added LOGGING to settings.py file according to the Django tutorial and importing logging. Nothing came out. I've also tried editing Run > Configurations in Pycharm but to no avail. #views.py from django.shortcuts import render, redirect from .models import Customer def index(request): if request.user.is_authenticated: groups = Customer.objections.select_related('group').values('name', 'address', 'group__name', 'group__limit') print(groups) for item in groups: print(item) context = {'group_list': {'data': list(groups)}} return render(request, 'index.html', context, request.user) else: return redirect('/accounts/login') My page loads fine but I just don't see any output to my consoles. -
Working with message broker(RabbitMQ /Redis) in django azure web site
I want to implement asynchronous task queuing system with Celery . I have a Django web app On azure web app service , one of the first steps is to install RabbitMQ or Redis on the server, How can i do it in Azure? Thanks, Nir -
Can't get initial value as modelchoicefield in django form
I have a column list. I'm trying to update one row from that list. After i select a row, i am trying to update it. After i select a row, i get one of the parameters which is table_id. table_id is defined in model.py and forms.py . I show that table_id as modelchoicefield in djangoproject but i can't initiate my instance value as modelchoicefield. updateView.py from django.shortcuts import render,redirect,get_object_or_404 from django.urls import reverse from django.contrib import messages from Columns_definition.forms import ColumnsDefinitionsForms from Columns_definition.models import sysColumns def update_table(request,id): column_data = get_object_or_404(sysColumns, id = id) columns_form = ColumnsDefinitionsForms(request.POST or None, request.FILES or None, instance = column_data) print("Data KOLON") print(columns_form) if columns_form.is_valid(): aciklama = request.POST.get('tabloid') columns_form.save() messages.info(request, "\'" + column_data.name + "\'" + "{}".format((": is updated"))) return redirect("Columns_definition:columns_def") context = { "columns_form":columns_form, "id":id, } return render(request, 'columnsCreate.html', context) forms.py from django import forms from Columns_definition.models import sysColumns from Utilities.custom_enum import DataTypes from Table_definition.models import sysTables class ColumnsDefinitionsForms(forms.ModelForm): datatype = forms.ChoiceField(choices=DataTypes, required=False, label='Alan Veri Tipi' , widget=forms.Select(attrs={ 'placeholder': '','class':'form-control select-access-open select2-hidden-accessible popUp' })) def __init__(self, *args, **kwargs): super(ColumnsDefinitionsForms, self).__init__(*args, **kwargs) self.fields['datatype'].choices.insert(0, ('','---------' ) ) tableid = forms.ModelChoiceField(queryset=sysTables.objects.all(), empty_label=None, widget=forms.Select(attrs={ 'class': 'form-control select-access-open select2-hidden-accessible' })) class Meta: model = sysColumns fields = [ 'tableid', 'name', … -
how to delete and objects from the db without refreshing the page?
I have a page that shows every objects in the database, this is handled by an ajax function that gets a JSON file containing every objects in the db and renders out some html code for every object. There's also a classic Django ModelForm that allows the creations of new db's objects, the new objects is instantly loaded with the others. I want an html button for every objects that deletes it "on the fly", so without redirecting to a Detail Delete template. $('.remove').on('click', function() { $.ajax({ type:'DELETE' url: 'http://127.0.0.1:8000/MyApp/list-api/' + $(this).attr('data-id') } When the button is clicked it should send a DELETE request to the url of the detail api of the object. Nothing happens, no new request in the network tab of the browser. This is my index.html <body> <h2>coffee orders</h2> <ul id="orders"> </ul> <h4>Add coffee order</h4> <form method="POST" action="."> {% csrf_token %} {{form.as_p}} <button id="add-order" type="submit">Add!!!</button> </form> <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script src="{% static 'MyApp/jquery_js.js' %}"></script> </body> This is my jquery.js, this function get the api and renders out the infos about the object and a delete button which doens't work. $(function (){ var $orders = $('#orders') $.ajax({ type: 'GET', url: 'http://127.0.0.1:8000/MyApp/list-api/?format=json', success: function(orders) { $.each(orders, function(i, order){ $orders.append('<li>name: … -
How to resolve a Django hstore error in tests
At some points in the app I'm collaborating on, a HStoreField is used (from django.contrib.postgres.fields). The app itself works normally, no build errors. But when I run tests, I get an issue: django.db.utils.ProgrammingError: type "hstore" does not exist From what I found, the issue is with Postgres, so I tried running the following command in psql: create extension hstore; on the template1 database. The extension now shows when listing extensions (\dx): hstore | 1.5 | public | data type for storing sets of (key, value) pairs Since the error is still here, this obviously wasn't the solution. What should I try? -
TypeError: produce() got an unexpected keyword argument 'linger_ms'
producer.produce('test msg'.encode(encoding='UTF-8'), partition_key=('{}'.format(count)) .encode(encoding='UTF-8'),timestamp=(datetime.datetime.now())+timedelta(seconds=120),linger_ms=120000) -
Unable to restrict access to the post edit screen with django
I am restricting access to the posted edit screen. I want to make sure that only the user who posted or the super user can edit the post. For that purpose, "UserPassesTestMixin" is used. However, there is no limit. And I think that my own "OnlyRecordEditMixin" is not responding. If you understand, thank you. #mixin class OnlyRecordEditMixin(UserPassesTestMixin): raise_exception = True def test_func(self): user = self.request.user id = self.kwargs['id'] print(id) return user.pk == URC.objects.get(id=id).user or user.is_superuser #view class RecordDetailEdit(UpdateView,OnlyRecordEditMixin): template_name = 'records/detail_edit.html' model = URC pk_url_kwarg = 'id' form_class = RecordDetailEditForm success_url = reverse_lazy('person:home') def get_object(self, queryset=None): obj = URC.objects.get(id=self.kwargs['id']) return obj #url path('<id>/edit/', views.RecordDetailEdit.as_view(), name='record_detail_edit'), #model class URC(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) -
Represent json data with PrimaryKeyRelatedField in django
I'm designing a mailbox with Django. My code is as follows: #models.py class Post(models.Model): text = models.CharField(max_length=256) sender = models.ForeignKey(User) receiver = models.ForeignKey(User) class Comment(models.Model): post = models.ForeignKey(Post) text = models.CharField(max_length=256) #serializers.py class CommentSerializer(serializers.ModelSerializer): post = serializers.PrimaryKeyRelatedField() class Meta: model = Comment fields = [ 'id', 'text', 'post' ] class PostSerializer(serializers.ModelSerializer): class Meta: model = Post fields = [ 'id', 'text', 'sender', 'receiver', ] class MainUserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ['username', 'email'] I tried to customize serializer and have a serializer as follows: class PostSerializer(serializers.Field): def to_representation(self, value): return PostSerializer(value, context={'request': self.context['request']}).data def to_internal_value(self, id): try: id = int(id) except ValueError: raise serializers.ValidationError("Id should be int.") try: post = Post.objects.get(pk=id) except User.DoesNotExist: raise serializers.ValidationError("Such a post does not exist") return user I want to represent comment objects like this { "post":{ "text" = "Hello" "sender" = 1 "receiver" = 2 } "text": "Greate" } My code works great but The problem is it doesn't show the Combo Box for selecting the post. I also tried to customize the PrimaryKeyRelatedField's to_represent method in this way: class PostSerializer(serializers.PrimaryKeyRelatedField): def to_representation(self, value): post_id = super(PostSerializer, self).to_representation(value) post = Post.objects.get(pk=user_id) return PostSerializer( user, {"context":self.context['request']} ).data but it says the unhashable type: … -
Generate kwargs for Django bootstrap_field
I'm trying to auto generate a list of fields for a Django form with the bootstrap4 package. I'm defining the kwargs in a dict, and want to loop through the fields and apply any kwargs to the bootstrap_field tag that comes with bootstrap4. Data data = [ { "name": "school_1", "args": { "show_label": True, }, }, { "name": "school_2", "args": { "show_label": False, }, }, ] Template: {% for field in form %} {% bootstrap_field field field|get_kwargs:data %} {% endfor %} Template filter: from django.template.defaulttags import register @register.filter def get_kwargs(formfield, data): item = next((item for item in data if item["name"] == formfield.name), None) if item: return item.get('args'): return None The issue is the bootstrap_field tag is using what the filter returns as an arg, not a kwarg. Is there anything I can do or do I need to replace bootstrap_field? Error render_field() takes 1 positional argument but 2 were given args (<django.forms.boundfield.BoundField object at 0x10f834240>, {'show_label': True}) kwargs {} -
Change Django admin forms according to the dropdown list value
When adding an item for a model in Django admin, is it possible to display different types of form accordingly based on the dropdown list value? For instance, I have a question model. Before adding question, admin will need to select the type of question he/she would like to add. Based on the type of question selected, it will display different fields/forms accordingly. -
How to do "Object of type StreamValue is not JSON serializable"
How to serialize StreamObject in wagtail. here i have StreamField object in my model and i want to make form for that model and want po list that model object in view. So how can i do that? -
How to display comments for users correctly?
I'm creating a blog app using Django and Python. I want users to be able to write and read comments under the posts. I've already created models.py, forms.py and views.py but I still have a problem with dispaying those comments. The user can write comments, but they are not dispayed under the post. However, I can see all those comments from admin page. I guess this problem is because of my templates. Could you help me please? What is wrong in my code? Thank you in advance! models.py from django.db import models from django.utils import timezone from django.contrib.auth.models import User from django.urls import reverse class Comment(models.Model): post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name='commens') author = models.CharField(max_length=100, default='') text = models.TextField() created_date = models.DateTimeField(default=timezone.now) approved_comment = models.BooleanField(default=False) def approve(self): self.approved_comment = True self.save() def __str__(self): return self.text views.py from django.shortcuts import render, get_object_or_404, redirect from django.http import HttpResponse from .models importPos, Comment from django.contrib.auth.models import User from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from .forms import CommentForm from django.contrib.auth.decorators import login_required def add_comment_to_post(request, pk): post = get_object_or_404(Post, pk=pk) if request.method == "POST": form = CommentForm(request.POST) if form.is_valid(): comment = form.save(commit=False) comment.post = post comment.save() return redirect('post-detail', pk=post.pk) else: form = CommentForm() return render(request, 'blog/add_comment_to_post.html', {'form': … -
Use data from a REST API that requires oAuth login, but that do not provide an authorization point
I'm not sure if my title makes sense, so here is the situation: I use a custom CRM (built with Django) on which I login with oAuth2 I want to extract the data from this app in order to display some statistics, or custom reports. Once I'm logged in, I can access the data with a JSON format just by adding a parameter such as http://example.com/backend/client/445/?format=json. As far as I know, there is no authorization point which could deliver a token for me to use in my app with an xhr request. Also, if I understand correctly, in any case, the CORS policy won't allow me to perform an xhr request. For the moment, I simply copy and paste the Json in my app but there is obviously a better way to do this, hence my question: As I am logged in on the CRM app in another tab, is there any way I can perform an Ajax request by leveraging the fact that I am logged in on this other tab ? I'm very new with all of this, so please let me know if I can give more informations. Thanks! -
How to add User registration data in admin after email confirmation?
Whenever someone new registers himself in my site, an email confirmation send to him. But before confirmation, his user information is adding in admin User page. I want it to add it in admin Users after confirmation not before. How to solve this problem? I didn't have models.py set because it is present {{forms}} in html page. forms.py class UserRegisterForm(UserCreationForm): email = forms.EmailField(required=True)._unique = True class Meta: model = User fields = ['username','email','password1','password2'] views.py def register(request): if request.method == 'POST': form = UserRegisterForm(request.POST) if form.is_valid(): user = form.save(commit=False) user.is_active = False user.save() current_site = get_current_site(request) mail_subject = 'Activate your Account.' message = render_to_string('users/active_email.html', { 'user': user, 'domain': current_site.domain, 'uid':urlsafe_base64_encode(force_bytes(user.pk)), 'token':account_activation_token.make_token(user), }) to_email = form.cleaned_data.get('email') email = EmailMessage( mail_subject, message, to=[to_email] ) email.send() return render(request, 'users/confirm_email.html') else: form = UserRegisterForm() return render(request, 'users/register.html', {'form': form}) def activate(request, uidb64, token): try: uid = force_text(urlsafe_base64_decode(uidb64)) user = User.objects.get(pk=uid) except(TypeError, ValueError, OverflowError, User.DoesNotExist): user = None if user is not None and account_activation_token.check_token(user, token): user.is_active = False user.save() return render(request, 'users/confirmed_email.html') return HttpResponse('Activation link is invalid!') tokens.py from django.contrib.auth.tokens import PasswordResetTokenGenerator from django.utils import six class TokenGenerator(PasswordResetTokenGenerator): def _make_hash_value(self, user, timestamp): return ( six.text_type(user.pk) + six.text_type(timestamp) + six.text_type(user.is_active) ) account_activation_token = TokenGenerator() -
Can't access smtp.gmail.com in virtualbox ubuntu18.04
I'm learning linux and Django with a Django project, developing in Ubuntu 18.04 installed in Virtualbox. The host machine is Windows 10 and the VM internet is NAT, which cannot be changed due to the internet of my office. And the problem is that, sending verify email for signup failed with OSError. I used smtp.gmail.com as email server and set all needed variables like host, user, pass, .etc And I don't think that's the problem. Then I tried telnet smtp.gmail.com port with port set to 465 and 587, and after a while, telnet just reported cannot connect. It seems that the out going port is blocked or something but changing iptables didn't fix this neither. So I think that maybe the Virtualbox internet settings caused this, but have no idea what to set or change. I would like to know is there anything I can try with the Virtualbox settings? Or maybe something else caused this? I'll fill more information if needed. Please help me out!! -
How to differentiate the answers of the different forms?
There is a page on which I display multiple forms, however I haven't found a way to get the result of the different forms separated. Here's the form class I am using: class QuestionnaireForm(forms.Form): def __init__(self, *args, **kwargs): extra = kwargs.pop('extra') super(QuestionnaireForm, self).__init__(*args, **kwargs) for i in range(len(extra)): self.fields[extra[i]['output']] = forms.IntegerField(label=extra[i]['question']) Here's the view, I basically loop over every of my activities and create a custom form however I am unable to identify what answer belong to which activity. class Questionnaire(TemplateView): template_name = 'blog/questionnaire.html' context = {'title': 'Questionnaire page'} def get(self, request): def create_questionnaires(activities): questionnaires = [] for activity in activities: output_list, activity = match_activity_and_subactivities_with_outputs(activity) questionnaires.append({'activity':activity['activity'], 'questionnaire':QuestionnaireForm(None, extra=output_list)}) return questionnaires, activities self.context['form_quest'], request.session['activities'] = create_questionnaires(request.session['activities']) return render(request,self.template_name, self.context) def post(self,request): output_list = request.session['output_list'] form_quest = QuestionnaireForm(request.POST, extra = output_list) if form_quest.is_valid(): request.session['outputs_inputs'] = [] for i in range(len(output_list)): output_list[i]['input']= form_quest.cleaned_data[output_list[i]['output']] request.session['outputs_inputs'].append([output_list[i]['output'],form_quest.cleaned_data[output_list[i]['output']]]) return redirect('/report', self.context) The questionnaire page: {% extends "blog/index.html" %} {% block content %} <h1>Questionnaire page</h1> <form method="post"> {% csrf_token %} {% for object in form_quest %} {% if object.questionnaire %} <h2> {{ object.activity }} </h2> {{ object.questionnaire.as_ul}} {% endif %} {% endfor %} <button type="submit">Submit</button> </form> <p> {{ context }} </p> {% endblock content %} As of now … -
How to create the django rest auth social login?
I have been trying to create a social login in django-rest-framework using django-rest-auth, but could not able to do it properly. I am a noob in these technologies and wants to create API for social login. Need Help in this. I have tried all the tutorials that are at the top in google search but they are incomplete or hard to understand. -
Process title for WSGI in apache
I have an apache web server, which starts a django server as a vhost. I'd like to name this subprocess and I've tried the parameter "display-name" of WSGIDaemonProcess. Unfortunately, I get the following error as soon as I start apache: Invalid command 'WSGIDaemonProcess', perhaps misspelled or defined by a module not included in the server configuration Do I need to include another module than mod_wsgi and mod_alias module? Apache starts if I remove the WSGIDeamonProcess line and it works perfectly. This is my vhost.conf <VirtualHost *:80> ServerName http://localhost ServerAdmin admin@example.com RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </VirtualHost> <VirtualHost *:443> SSLEngine on SSLCertificateFile "${INSTALLDIR}/cert/localhost.pem" SSLCertificateKeyFile "${INSTALLDIR}/cert/localhost.key" ServerName https://localhost ServerAdmin admin@example.com DocumentRoot "${INSTALLDIR}/client" DirectoryIndex index.html index.htm index.php index.php4 index.php5 <Directory "${INSTALLDIR}/client"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> # wsgi python backend WSGIDaemonProcess webapp display-name=django-myapp WSGIScriptAlias /api2 "${INSTALLDIR}/webapp/api/wsgi.py" WSGIProcessGroup webapp WSGIPassAuthorization On <Directory "${INSTALLDIR}/webapp/api"> <Files wsgi.py> Require all granted </Files> </Directory> ErrorLog "${SRVROOT}/logs/error.apache.log" ErrorDocument 404 /404.html </VirtualHost> Does anybody has a solution how I can name the subprocess? -
Can't Deploy Mezzanine CMS using Apache/Ubuntu
I'm trying to become better with deploying a website from scratch so I setup a new Nanode from Linode using the latest Ubuntu (19.04 I think). I followed the instructions to install Mezzanine CMS (Django Based) and it all went fine, I was able to run the dev server to test the website fine on port 8000. I did install UFW and right now only activity on port 80 is not rejected. Also I have mysql database running with Mezzanine not Djangos default SQLlite. I installed Apache and WSGI. At first Apache would not restart due to some configuration issue which I think I've since worked out. I have a domain alexmerced which is on godaddy, but I have a DNS "a" records which is pointing to my linodes IP address "mezz.alexmerced.com" Mezzanine is still a fresh install so I haven't really changed anything outside of the WSGI and settings.py. I currently get a forbidden error when I type the URL or IP address, the permissions of the application directory is 755. below are my configuration file settings to see if I made any mistakes. django_project.conf (the only conf file enabled in the /sites-available/ directory <VirtualHost *:80> ServerName mezz.alexmerced.com ServerAdmin …