Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django/Celery/WSGI Dropping telemetry
My Django app is giving this error while some HTTP requests are happening. Using Django, Celery, and WSGI with MSSQL, and frontend react -
Django CBVs to return a JsonResponse?
I have been using Django for quite some time, but running into some issues with trying something new. I have built API's with Django-Rest-Framework using Class Based Views, and I have also built API's using Function based views returning a JsonResponse Now what I am tasked to do is use CBV's to return a JsonResponse without using DRF. I am trying to produce a simple get request class BusinessDetailView(DetailView): model = BusinessDetail def get_queryset(self): business = BusinessDetail.objects.get(id=self.kwargs.get('pk')) return JsonResponse({'business': list(business)}) Using the models pk I keep running into issues with this simple request. I am getting a TypeError 'BusinessDetail' object is not iterable and if I make some small changes and override get_object I'll get the same error, or I'll even get a 'BusinessDetail' object is not callable Does anybody have any tips with using CBVs to return Json, without using DRF? Thank you all in advance! -
Save content of Modelchoicefield Django
I have a form PurchaseOrderDetailsForm contain product_attr CharField which not related to any other model. In the form, I'm using product_attr field as a model choice field with ProductAtrributes instance and get data with ajax by product id. Now I'm trying to save product_attr filed content into the PurchaseOrder_detail table but unable to save or insert data into the product table. without this, product_attr filed it's working fine. Any help would be greatly appreciated. Model: PurchaseOrder_detail product = models.ForeignKey('Product', blank=True, null=True, on_delete=models.SET_NULL) product_attr = models.CharField(max_length=50, blank=True, null=True) Model: ProductAttributes class ProductAttributes(models.Model): product = models.ForeignKey('Product', blank=True, null=True, on_delete=models.SET_NULL) size = models.ManyToManyField('ProductSize', blank=True) colour = models.ManyToManyField('ProductColour', blank=True) cupsize = models.ManyToManyField('ProductCupSize', blank=True) def __str__(self): return str(self.product) Form: class PurchaseOrderDetailsForm(forms.ModelForm): product = forms.ModelChoiceField(label=('Product'), required=True, queryset=Product.objects.all(), widget=Select2Widget(attrs={'style': 'width:100%;', 'class': 'form-control'},)) product_attr = forms.ModelChoiceField(label=('Attributes'), queryset=ProductAttributes.objects.none(), widget=Select2Widget()) class Meta: model = PurchaseOrder_detail exclude = () ajax: // load attributes $(document).on("change", ".product", function() { var selector = $(this) $.ajax({ url: '/purchase/ajax/load-attrs/', type: "POST", data: { 'product': $(this).parents('tr').find(".product").val() }, success: function (data) { selector.parents('tr').find(".product_attr").html(data); } }); }); Template: <option value="">---------</option> {% for attr in attrs %} <option value="{{attr.product|default_if_none:"" }}{{attr.colour__name|default_if_none:"" }}{{attr.size__name|default_if_none:"" }}{{attr.cupsize__name|default_if_none:"" }}"> {{attr.colour__name|default_if_none:"" }}{{attr.size__name|default_if_none:"" }}{{attr.cupsize__name|default_if_none:"" }} </option> {% endfor %} view: def form_valid(self, form): context = self.get_context_data() order_details = … -
Heroku forcing my Django application to use SSL doesnt work
I followed instructions of Heroku devcenter: MIDDLEWARE = [ # SecurityMiddleware must be listed before other middleware 'django.middleware.security.SecurityMiddleware', # ... ] SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') SECURE_SSL_REDIRECT = True On Heroku setting its said that "Your app can be found at https://----------.net" so the SSL is configured fore sure, nethertheles when I write on browser only domain name without protocol I get ERR_SSL_PROTOCOL_ERROR (Chrome) and on Safari - "Safari can not open the page because it could not estabish a secure connection to the server" Any hint please what more can I do? -
Django using select options in registration forms.py
I put some teams in my models.py in this way: class Account(AbstractBaseUser): TEAM = (('python', 'python'), ('php', 'php')) ... username = models.CharField(max_length=16, unique=True) first_name = models.CharField(max_length=16, unique=True) last_name = models.CharField(max_length=16, unique=True) member_of = models.CharField(max_length=20, choices=TEAM, default=STATUS[0][0]) USERNAME_FIELD = 'username' REQUIRED_FIELDS = ['first_name', 'last_name'] objects = AccountManager() def __str__(self): return self.username def has_perm(self, perm, obj=None): return self.is_admin def has_module_perms(self, app_label): return True and my forms.py is like: class RegistrationForm(UserCreationForm): #email = forms.EmailField(max_length=50) class Meta: model = Account #fields = '__all__' fields = ['username', 'first_name', 'last_name', 'password1', 'password2', 'member_of'] So when I want to use it in my registration.html I am not able to create account: <div class="group text-left"> <label for="exampleFormControlInput1">team</label> <select name="status" class="form-control" id="exampleFormControlSelect2"> {% for team in registration_form.member_of %} {{team}} {% endfor %} </select> </div> and also it is not important to use registration_form.member_of. If I only put member_of in my forms.py I can't register new users -
Post request fails in Django Rest Framwork due to CSRF Token missing
I am trying to make a POST request to my DRF API Endpoint through a React frontend. I get a 403 Forbidden (CSRF token missing or incorrect.): /api/content/wishlists error. I looked at other solutions, and most of them point out that the default django authentication classes need to be adapted to DRF. I am working with django-rest-knox for authentication purposes so my settings.py contains: # REST Framework Settings REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ('knox.auth.TokenAuthentication',) } I still keep receiving this error. Here is the api.py class WishlistViewset(viewsets.ModelViewSet): serializer_class = WishlistSerializer queryset = Wishlist.objects.all() permission_classes = [ permissions.IsAuthenticatedOrReadOnly ] def list(self, request): queryset = Wishlist.objects.all() serializer = WishlistSerializer(queryset, many=True) return Response(serializer.data) def retrieve(self, request, pk=None): queryset = Wishlist.objects.all() wishlist = get_object_or_404(queryset, pk=pk) serializer = WishlistSerializer(wishlist) return Response(serializer.data) def perform_create(self, serializer): serializer.save(owner=self.request.user) My Javascript code to trigger the api call const createWishlist = (content, setCreated) => { axiosInstance .post(`/content/wishlists`, content, tokenConfig(auth.token)) .then((res) => { dispatchMessages(createMessage({ contentAdded: "Wishlist created" })); setCreated(res.data.id); }) .catch((err) => dispatchErrors(returnErrors(err.response.data, err.response.status)) ); }; Where the tokenConfig function basically just adds a header with the authentication token to the request like this: export const tokenConfig = (token) => { // headers const config = { headers: { "Content-Type": "application/json", }, … -
How to make a input in Admin page as password type?
hello i create a model wich have 3 fields, name,email,password. i want the password in the admin to not show as clear text or to not show even . any ideas to change input type in the admin page from type='text' to type='password' image of password input in my admin page Models.py class Artist(models.Model): artist_name = models.CharField(max_length=255,null=False,blank=False) email = models.EmailField(max_length=255, null=False,blank=False) password = models.CharField(max_length=20, null=False,blank=False) def __str__(self): return self.artist_name admin.py from django.contrib import admin from home.models import Track , Artist , Region , User admin.site.register(Artist) -
Django error: type object 'Enter' has no attribute 'objectes'
Screenshot from 2020-12-07 21-23-28.png Hello my friends I am facing this problem and I have not found a solution. I hope you will help me -
Associating New products with the Current User in django
Currently If i try adding a new product , i get this error IntegrityError "NOT NULL constraint failed: products.merchant_id" what i want to achieve is product to be associated with the current user. models.py class Product(models.Model): name = models.CharField(max_length=255, unique=True) date_added = models.DateTimeField(auto_now_add=True) merchant=models.ForeignKey(Merchant, on_delete=models.CASCADE,null=True) class Merchant(models.Model): user=models.OneToOneField(User,on_delete=models.CASCADE, primary_key=True) views.py def addproduct(request): if request.method=='POST': form=ProductForm(request.POST) if form.is_valid(): new_product=form.save(commit=False) new_product.merchant__user=request.user new_product.save() return HttpResponseRedirect('users:users_homepage') else: form=ProductForm() context={'form':form} return render(request,'users/addproduct.html',context) -
How to update a related Django model for a newly created instance
I am trying to create a database object and also update the related payouts table at the same time. When I try to update table using the related name payouts__payout_status_client="Hello" it doesn't work. models.py class Invoices(models.Model): invoice_ref = models.CharField(max_length=10, default="", blank=True) week_start_date = models.DateTimeField(auto_now_add=False) week_end_date = models.DateTimeField(auto_now_add=False) invoice_gross_value = models.DecimalField(max_digits=settings.DEFAULT_MAX_DIGITS, class Payouts(models.Model): invoice = models.ForeignKey( Invoices, null=True, related_name="payouts", on_delete=models.PROTECT ) payout_status_client = models.CharField(max_length=10, default="Pending", blank=True) payout_status_hungryme = models.CharField(max_length=10, default="Pending", blank=True) views.py create_record = Invoices.objects.update_or_create(invoice_ref=invoice_ref, payouts__payout_status_client="Hello") -
Django + Gunicorn + Nginx. 404
I am trying to run django + gunicorn + nginx locally. For some reason nginx is not getting data from static. Please tell me what am I doing wrong? Gunicorn: gunicorn config.wsgi:application --bind 127.0.0.1:8001 Nginx config: # mysite_nginx.conf upstream project_server { server 127.0.0.1:8001; } # the upstream component nginx needs to connect to # configuration of the server server { # the port your site will be served on listen 80; # the domain name it will serve for server_name localhost; # substitute your machine's IP address or FQDN # max upload size client_max_body_size 75M; # adjust to taste # Django media location /media { alias /home/ferom/Programming/my_avatar_clock/media; # your Django project's media files - amend as required } location /static { alias /home/ferom/Programming/my_avatar_clock/my_avatar_clock/proj/static; # your Django project's static files - amend as required } location / { proxy_pass http://127.0.0.1:8000; proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Real-IP $remote_addr; add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"'; } } Folders: In settings.py STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') But when I open http://127.0.0.1/admin/ Nginx say me: 404. cat /var/log/nginx/error.log - empty What am I doing wrong? -
How do I add a default value to a nested serializer?
I am trying to have my "address" API return the default value (empty string ""), but when I use default="" in the serializer field it returns null instead. This is my main serializer (LocationSerializer) class LocationSerializer(serializers.ModelSerializer): id = serializers.UUIDField(read_only=True) business_id = serializers.PKRelatedField(Business.any.all(), "business") city_id = serializers.UUIDField(required=True) name = serializers.CharField(max_length=48, required=True) tax_number = serializers.CharField(max_length=48) phone = serializers.PhoneNumberField() address = serializers.CharField() address_details = AddressEmbeddedSerializer(default="", source="addresses") footer = serializers.CharField() is_active = serializers.BooleanField(required=True) has_kds = serializers.BooleanField(read_only=True) position = serializers.PointField() image = serializers.ImageField() # profile = LocationProfileSerializer() permissions = PermissionSerializer(many=True, read_only=True) payment_methods = PaymentMethodEmbeddedSerializer(many=True, read_only=True) class Meta: model = Location fields = ( "id", "business_id", "city_id", "name", "tax_number", "phone", "address", "address_details", "footer", "is_active", "has_kds", "position", "image", "permissions", "payment_methods" ) and this is my nested serializer (AddressEmbeddedSerializer) class AddressEmbeddedSerializer(serializers.ModelSerializer): city = serializers.CharField(default="") area = serializers.CharField(default="") block = serializers.CharField(default="") avenue = serializers.CharField(default="") long = serializers.CharField(default="") lat = serializers.CharField(default="") class Meta: model = LocationAddress fields = ( "city", "area", "block", "avenue", "long", "lat" ) The value that I am expecting is: "address_details": { "city": "", "area": "", "block": "", "avenue": "", "long": "", "lat": "" } Instead what I am getting is: "address_details": null Please note that all CRUD operations are working, this is only a default value … -
When trying to get a model field i get DeferredAttribute object Django
Hello so basically i have a profile model that keeps track of points. And i group those profiles into groups as students. So basically in the groups i have a method going through all of the students in the group and returning a list of points but it's intended to be sum(), (since im getting an error i tried a list to debug). How do i get the actuall value instead of the object? This is the code: class profil(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) points = models.SmallIntegerField(default=0) def __str__(self): return self.user.username def addPoints(self, amount): self.points += amount def subtractPoints(self, amount): self.points -= amount def changePoints(self, amount): self.points += amount class skupine(models.Model): choices = ( ('#52A2D9', 'Modra'), ('#8ec641', 'Zelena'), ('#f3c12f', 'Rumena'), ('#e2884c', 'Oranžna'), ('#f37358', 'Rdeča'), ('#b460a5', 'Vijolična') ) teacher = models.ForeignKey(User, on_delete=models.CASCADE, related_name='teacherToSkupina') title = models.CharField(max_length=30) desciption = models.CharField(max_length=120, null=True) color = models.CharField(max_length=7, choices=choices) students = models.ManyToManyField(profil, related_name='studentsToSkupina') def __str__(self): return self.title def get_total_points(self): return list(profil.points for items in self.students.all()) class Meta: verbose_name_plural = "skupine" What i get when i call the method : >>> s.get_total_points() [<django.db.models.query_utils.DeferredAttribute object at 0x03D957D0>, <django.db.models.query_utils.DeferredAttribute object at 0x03D957D0>, <django.db.models.query_utils.DeferredAttribute object at 0x03D957D0>, <django.db.models.query_utils.DeferredAttribute object at 0x03D957D0>, <django.db.models.query_utils.DeferredAttribute object at 0x03D957D0>, <django.db.models.query_utils.DeferredAttribute object at 0x03D957D0>, <django.db.models.query_utils.DeferredAttribute … -
How to add a folder to Django?
So my question looks like this Creating a new project django-admin startproject firstapp Creating a new app python manage.py startapp blog So, my question is . I've added a new folder called "projects" within the app "blog" Django doesn't see the folder. How to connect? via INSTALLED_APPS (I've tried it doesn't work) -
social-auth-app-django error creating table for column social_auth_usersocialauth.created does not exist
I am not sure where is the issue and not sure why the auth package is not creating the table. but also the facebook individual verification is also disabled due to COVID-19. I don't get the option to verify which maybe why but I am not sure. [the table error I get when I try to login through Facebook oauth2][1] """ #settings.py file settings # pipeline SOCIAL_AUTH_PIPELINE = ( 'social_core.pipeline.social_auth.social_details', 'social_core.pipeline.social_auth.social_uid', 'social_core.pipeline.social_auth.social_user', 'social_core.pipeline.user.get_username', 'social_core.pipeline.social_auth.associate_by_email', 'social_core.pipeline.user.create_user', 'social_core.pipeline.social_auth.associate_user', 'social_core.pipeline.social_auth.load_extra_data', 'social_core.pipeline.user.user_details', ) AUTHENTICATION_BACKENDS = ['social_core.backends.facebook.FacebookOAuth2','django.contrib.auth.backends.ModelBackend',] SOCIAL_AUTH_URL_NAMESPACE = 'social' SOCIAL_AUTH_FACEBOOK_SCOPE = ['email'] SOCIAL_AUTH_FACEBOOK_KEY = '855857298498541' SOCIAL_AUTH_FACEBOOK_SECRET = '9f5f0e8af7834122773d5b5f4ec03cb4' SOCIAL_AUTH_FACEBOOK_SCOPE = ['email', 'user_link'] SOCIAL_AUTH_FACEBOOK_PROFILE_EXTRA_PARAMS = { 'fields': 'id, name, email, picture.type(large), link' } SOCIAL_AUTH_FACEBOOK_EXTRA_DATA = [ ('name', 'name'), ('email', 'email'), ('picture', 'picture'), ('link', 'profile_url'), ] SOCIAL_AUTH_REDIRECT_IS_HTTPS = True # SOCIAL_AUTH_POSTGRES_JSONFIELD = True # installed apps including all the packages INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'social_django', 'django_extensions', 'storages', 'socialApp.apps.SocialappConfig', ] # middleware for the application MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', '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', 'social_django.middleware.SocialAuthExceptionMiddleware', ] """ [1]: https://i.stack.imgur.com/j5Tnj.png -
Django: access __init__.py of project from within an app
This is the files structure: project -> my_project -> __init__.py -> my_app -> templatetags -> extras.py project/my_project/__init__.py contains: __version__ = '1.0.0' VERSION = __version__ # synonym I want to access VERSION or __version__ in project/my_project/my_app/templatetags/extras.py But if I try to: from my_project import VERSION I get ImportError: cannot import name 'VERSION' from 'my_project' What is the correct way to get the version string? Background: In extras.py I define a simple_tag with the version number so I can display the version number in templates. In this answer the version string is achieved by parsing the python file with a regex but this does not seem like an acceptable solution to me, and I'm sure there is a way to untangle this import knot. -
Django + React -> fetch / axios
I want fetch data to Django backend from React and request the params in url with 'request.GET.get("",None)' [or alternatives?]. The best case would be a solution for multiple params or in body. Every tutorial only shows fetch to models, but all references I found for request or create() the parameters in my views.py ( to do other stuff with values in views) did not work. //Form.js var url = 'http://127.0.0.1:8000/api/'+'?name='+name+'/' axios.post(url, { title: title, value1: value1, value2: value2, }) I want to scrap the 'name' from url (in next steps I need 'params' from body, too) in my views.py to do further action with the values. #views.py def my_view(request, name): request_name = request.GET.get("name", None) I think possible problem with the urls referenced param 'name', from django.contrib import admin from django.urls import path, include, re_path urlpatterns = [ path('api-auth/', include('rest_framework.urls')), path('admin/', admin.site.urls), path('api/', views.my_view ), path('api/<name>/', views.my_view ), #path('api/(?P<name>\d+)/', views.my_view), #re_path('api/<name>)/', views.my_view , name='name'), #re_path('api/(?P<name>\d+)/', views.my_view , name='name'), #path('api/<name>/)', views.my_view , name='name'), #re_path(r'^api/<name>/$', views.my_view), because, when I tried: fetch url 'http://127.0.0.1:8000/api/'+name+'/' -> without the '?name=' with this urls.py path('api/<name>/', views.my_view ) I can print(name) in views.py -> results is correct name def my_view(request, name): #request_name = request.GET.get("name", None) print(name) print(name) does … -
What "rc" stands for in the latest Python 3.91rc1 version name
as mentioned in the title.. What "rc" stands for in the latest Python 3.91rc1 version name? Thanks -
date and time is not showing its showing none instead
i am trying to show date and time in template but its shwoing none Here is models.py:: date = models.DateTimeField(blank=True, null=True, auto_now_add=True) Here is my templete: <td>{{order.date}}</td> -
Run a function from an imported module using Django
I'm trying to run a function from an imported class when the user clicks a button on the webpage. views.py def smartsheet_int(request): #if request.method == 'GET': from .platsheet.land_schedules import Schedule # call function sch = Schedule() sch.import_plats() return redirect('community-home') urls.py path('communities/actionUrl', smartsheet_int, name='actionUrl'), html <form action='actionUrl' method='GET'> <button type='submit' >Update Smartsheet</button> </form> When I click the button, it initializes the class and runs the function as expected. However, it doesn't work when I try to re-run it after changing data on the website. It doesn't generate an error...it's like it doesn't re-initialize the class or something (which needs to happen because the function is querying from Django's database). It will only work again if I stop the python server and re-start it again. Thoughts? -
Displaying a Decimal Field as a Slider in Django
I have defined a Decimal Field in my Forms.py class Slider(forms.Form): slider_form= forms.DecimalField(min_value=0.0, max_value=1.0, initial = 0.5, required=True, label=False, decimal_places=1, widget=forms.NumberInput(attrs={'step': "0.1"})) Is there a good way to convert the display to a slider in Django? Would it be better to attack this on the front-end instead using Javascript? -
drf-spectacular Can't find inspector class
I am trying to set up drf-spectacular to generate an AutoSchema for my djangorestframework API. I have set it up as explained in the Readme, e.g., in installed apps, version = "~=0.11.1", and in the rest framework settings as below: REST_FRAMEWORK = { ..., 'DEFAULT_SCHEMA_CLASS': ('drf_spectacular.openapi.AutoSchema',), } My djangorestframework is version 3.12. I am getting an error when I run the following command: ./manage.py spectacular --file schema.yml Here's an example view of mine: class LinkListView(ListView): permission_classes = [AllowAny] template_name = "core/linklist.html" context_object_name = "link_list" def get_queryset(self): return Org.objects.all() After reading a bunch on schemas, I'm thinking that I have some other library that is conflicting with this or that some previous other swagger alternatives are conflicting. Does this make sense based on the error? Is there something I'm missing to try? Thanks! Traceback (most recent call last): File "./manage.py", line 23, in <module> main() File "./manage.py", line 19, in main execute_from_command_line(sys.argv) File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute output = self.handle(*args, **options) File "/usr/local/lib/python3.8/site-packages/drf_spectacular/management/commands/spectacular.py", line 50, in handle schema = generator.get_schema(request=None, public=True) File "/usr/local/lib/python3.8/site-packages/drf_spectacular/generators.py", line 188, in get_schema paths=self.parse(request, … -
How to implement a Refresh Token View in Django
I am using Django Rest Framework and the simple jwtToken. I have implemented the JWT authentication for the login and I get as a return an access and a refresh token. This works fine. However I don't know how to use the refresh Token. If we hit a specific endpoint, eg api/refresh with body params the tokens {access= '' refresh=''} I need to decode the access token to see if it has expired, then to get the users credentials hidden there (by default in the jwt the id) and then to give as a responce the new access token. How can I implement this? -
How to render raw HTML block from Rich Text Editor after Axios request?
So my backend is Django with Django Rest API and there I create my blog posts which are rendered in Nuxt page using "v-html" directive. Problem 1: Uploaded images inside of Rich editor in Django is not rendering in Nuxt (Aim is to be able to add pictures in the middle of blog post) Problem 2: Codeblocks (html code block with markdown) inserted in Rich Editor is being rendered in Nuxt without any styles, whereas the same codeblock being inserted as a Nuxt data object is rendered with styles. (Aim is to be able to insert codeblocks in rich editor so its rendered in Nuxt with styles) As a rich text editor in Django Admin I use Django-Trumbowyg. I searched everywhere, however couldn't find the proper solution! All the solutions I digged out in internet are "workarounds" and from my point of view its not the way it is supposed to be. I would more than glad if you could provide a reference if it's a duplicate or help me to find out a solid solution. :) -
User account gets Permission Denied Error but admin doesn't when uploading a file Django Apache
I deployed a Django app that allows users to upload files on a VPN running Debian and the app works for the admin i.e. I can upload files but whenever I try to upload a file as an ordinary user I get [Errno 13] Permission denied: '/file' The directory where all of the files are saved is called file. My user is called webcodefy. The current structure of the server is fms -> fms (virtual env) -> Django App, static folder, file folder. This is my default.conf file: # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html Alias /static /home/webcodefy/fms/fms/static <Directory home/webcodefy/fms/fms/static> Require all granted </Directory> <Directory home/webcodefy/fms/fms/WebApp> <Files wsgi.py> Require all granted </Files> </Directory> Alias …