Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Python: Django/Flask/ Casino/Payment [closed]
One wants to build casino, but one wants to figure out what one needs to know to do the most essential thing of it, knowing how to make real money convert to the 'points' or 'markers', and perhaps some ranking visuals of the top players or most returning costumers is fine too, so one need to know this, and one wondering what one should look into? what areas, and topics? Perhaps need to better my knowledge in some areas, and such, but one is dedicated to this project, perhaps need to develop some software in tkinter. One is at the moment concidering using django but maybe flask would be more suited for it from, web developments stand point? Django always feel as a superhighway, perhaps more advanced projects is better to do in flask? -
Django form invalid, Field is required, even through input is given
I am getting invalid form error: this Field is required views: class ValueSubmitView(TemplateView): template_name = 'multichoice.html' def get(self, request, *args, **kwargs): return render(request, self.template_name, {'form': symptomsForm}) def post(self, request, *args, **kwargs): form =symptomsForm(request.POST) if form.is_valid(): print('is valid called') values = form.cleaned_data.get("symptoms") print(values) return send_rich_text_response(request, { 'answer': values, }) else: print('form invalid', form.errors) return render(request, self.template_name, {'form': form}, content_type='text/html') whereas my form.py is class symptomsForm(forms.Form): MEDIA_CHOICES=((1,'Dry Cough'),(2,'Loss or diminished sense of smell'),(3,'Sore Throat'),(4,'Weakness'),(5,'Change in Appetite'),(6,'None of above'),) symptoms = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple( attrs={ 'class':'some classes ' } ),choices=MEDIA_CHOICES) HTML page is: <form method="post" onsubmit="submit_form('{% url "Value-Submit-View" %}','Value-Submit-View')" class="book-test-drive border pt-3 pl-3 pr-3 pb-1"> {% csrf_token %} <p class="h5-responsive text-center font-weight-bold text-body">Symptoms</p> <div class="row"> <div class="col-12"> {{ form.symptoms }}</div> </div> <div class="row"> <div class="col-12 text-center"> <input type="submit" class="btn btn-indigo btn-sm btn-submit"> </div> </div> </form> I even tried different form fields like char field but didn't work out, getting the same error, I tried this same code in my previous project which work well but the difference is I used it for form model back then error: <ul class="errorlist"><li>symptoms<ul class="errorlist"><li>This field is required.</li></ul></li></ul> -
Cannot install pip package dependencies cloned from a GitHub repo into a separate virtualenv
I have forked and cloned a private Django GitHub repo of a friend of mine into my local directory. Since I am using Windows 8 and my friend created the repo using Linux(Ubuntu), I couldn't use his virtual env. So, I created a separate virtual environment using virtualenv(16.7.8) in my local directory. However, when I run pip install -r requirements.txt only some packages gets installed and others give error. So I had to install all the required packages by manually typing with their specific versions. However, I am unable to install two particular dependencies viz. django-compressor and rcssmin. When I ran pip install django-compressor==2.4 It "failed to build wheel for rcssmin" and logged an error on the terminal that reads error: Microsoft Visual C++ 14.0 is required .... The full error log is shown below: How do I solve this? Also, is there an alternative and better way to work on GitHub projects like this where I have to involve different OS(without using virtual machines to match OS)? -
How to add custom response message in django rest swagger?
I have created a custom function to write parameters with Django rest swagger schema = coreapi.Document( title='Thingy API thing', 'range': coreapi.Link( url='/range/{start}/{end}', action='get', fields=[ coreapi.Field( name='start', required=True, location='path', description='start time as an epoch', type='integer' ), coreapi.Field( name='end', required=True, location='path', description='end time as an epoch', type='integer' ) ], description='show the things between the things' ), } ) this produces below result But it does not help in writing custom response messages. I want to write custom response messages also. How can i do that -
unable to run django-nose test with coverage in Django
I've django-nose installed in my virtual environment and added in my settings.py file as follows : INSTALLED_APPS = ( 'backoffice_engine', 'items', ... ... 'django-nose', ) # Use nose to run all tests TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' # Tell nose to measure coverage on the 'backoffice_engine' app NOSE_ARGS = [ '--with-coverage', '--cover-package=backoffice_engine', ] the folder structure of backoffice_engine app is as follows │ admin.py │ apps.py │ forms.py │ models.py │ urls.py │ views.py │ views_ithcos.py │ views_ithcos_mtas.py │ __init__.py │ ├───migrations │ │ 0001_initial.py │ │ 0002_auto_20180414_0836.py │ │ ├───templatetags │ │ backoffice_extras.py │ │ __init__.py | ├───tests │ │ tests_forms.py │ │ tests_models.py │ │ tests_views.py │ │ test_urls.py │ │ __init__.py in my test_views.py file i have from django.test import SimpleTestCase class Testviews(SimpleTestCase): def test_sample_view(self): self.assertEqual(1 == 1) similarly in my test_models.py file i have: from django.test import SimpleTestCase class Testmodels(SimpleTestCase): def test_sample_model(self): self.assertEqual(1 == 1) my understanding is that i now have total of two tests and doing python manage.py test --keepdb should show me a coverage report of all the files in my app that were tested and test result stating 2 test were conducted and both were successful however i get coverage report as expected but … -
Django : how to display images from database in template?
Hi I don't know why but I can't display images from my database. I think it is because of my path in my template. My model : class Article(models.Model): titre = models.CharField(max_length=200) auteur = models.CharField(max_length=200) pub_date = models.DateTimeField('date de publication') numero = models.CharField(max_length=200) categorie = models.CharField(max_length=200, default="culture") contenu = models.CharField(max_length=200000) image = models.ImageField(upload_to='image_publie', blank=True, null=True) def __str__(self): return self.titre def was_published_recently(self): return self.pub_date >= timezone.now() -datetime.timedelta(days=7) My view : def detail(request, article_id): article = get_object_or_404(Article, pk=article_id) return render(request, 'gazette/detail.html', {'article':article}) My url : path('<int:article_id>/', views.detail, name='detail'), Settings : STATIC_URL = '/static/' MEDIA_URL = '/images/' MEDIA_ROOT = os_path.join(BASE_DIR, 'images/') STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ] My template : {% extends "base.html" %} {% load static %} {% block content %} <h1>{{ article.contenu }}</h1> <ul> {% if article.image %} <img src="{{article.image.url}}" alt="{{article.titre}}" style="width: 200px; height: 200px;"> {% endif %} </ul> {% endblock %} And : And what I see on my template -
Test case written for url resolver using resolve() in django application not working
I am trying to write test cases for simple user login and registration system in django. First, I was thinking of writing test cases for the urls. The only test case I have written so far is from django.test import SimpleTestCase from django.urls import reverse, resolve, path from main.views import homepage, register, login_request, logout_request import json # Create your tests here. class TestUrls(SimpleTestCase): def test_list_is_resolved(self): url = reverse('homepage') self.assertEquals(resolve(url).func,homepage) The default urls.py is from django.contrib import admin from django.urls import path, include urlpatterns = [ path('tinymce/',include('tinymce.urls')), path("",include('main.urls')), path('admin/', admin.site.urls), ]` The main application urls.py is from django.urls import path from . import views app_name='main' # here for namespacing the urls urlpatterns = [ path("", views.login_request, name="login"), path("homepage/",views.homepage, name="homepage"), path("register/", views.register,name="register"), path("logout", views.logout_request, name="logout"), ]` Now every time I am running the tests, I am getting the following error. (myproject) C:\Users\rohan\mysite>py manage.py test System check identified no issues (0 silenced). E ====================================================================== ERROR: test_list_is_resolved (main.tests.test_urls.TestUrls) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\rohan\mysite\main\tests\test_urls.py", line 11, in test_list_is_resolved url = reverse('homepage') File "C:\Users\rohan\Envs\myproject\lib\site-packages\django\urls\base.py", line 87, in reverse return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)) File "C:\Users\rohan\Envs\myproject\lib\site-packages\django\urls\resolvers.py", line 677, in _reverse_with_prefix raise NoReverseMatch(msg) django.urls.exceptions.NoReverseMatch: Reverse for 'homepage' not found. 'homepage' is not a valid view … -
Autlib vs OAuthlib: Are these libraries the same?
I am a beginner in the world of the OAuth2.0 and OpenID Protocols. I would like to implement a custom server - provider for multiple applications. So, to use it for Single Sign-On (SSO). I would like to work with python. Till now I have found four packages, for an OAuth2.0 and an OpenID Connect server implementation, in Python: pyoidc, django-oidc-provider, Django OAuth Toolkit (DOT) by OAuthlib and Authlib. I tried to read and understand pyoidc, but it was not so helpful and easy, basic things were missing. I have tried django-oidc-provider and I was really satisfied, and the whole implementation was really easy. So, after those trials, I am left with Django OAuth Toolkit (by OAuthlib) and Authlib. Has anyone tried them? Are these packages the same? Is Authlib an updated version of the OAuthlib library? The only information I know till now, is that Flask-OAuthlib is deprecated, and Authlib is was its new version. *Every answer or advice or personal experience would be really helpful and always appreciated! Thank you again for your help. -
i cant make the image_url to load on local host please hlp
i am making like a demo website that sells fruits i am following a youtube tutorial by (code with mosh) his images loaded properly but my images wont other things like add to cart button and name of product loaded properly. i ghave added on one url i.e ( https://upload.wikimedia.org/wikipedia/commons/7/7b/Orange-Whole-%26-Split.jpg ) admin.py from django.contrib import admin from .models import Product, Offer class OfferAdmin(admin.ModelAdmin): list_display = ('code', 'discount') class ProductAdmin(admin.ModelAdmin): list_display = ('name', 'price', 'stock') admin.site.register(Product, ProductAdmin) admin.site.register(Offer, OfferAdmin) apps.py from django.apps import AppConfig class ProductsConfig(AppConfig): name = 'products' models.py from django.db import models class Product(models.Model): name = models.CharField(max_length=255) price = models.FloatField() stock = models.IntegerField() image_url = models.CharField(max_length=2083) class Offer(models.Model): code = models.CharField(max_length=10) description = models.CharField(max_length=255) discount = models.FloatField() urls.py from django.urls import path from . import views urlpatterns = [ path('', views.index), path('new', views.new) ] views.py from django.http import HttpResponse from django.shortcuts import render from .models import Product def index(request): products = Product.objects.all() return render(request, 'index.html', {'products': products}) def new(request): return HttpResponse('New products') index.py {% extends 'base.html' %} {% block content %} <h1>Products</h1> <div class="row"> {% for product in products %} <div class="col"> <div class="card" style="width: 18rem;"> <img src="{{ image_url }}" alt="..."> <div class="card-body"> <h5 class="card-title">{{ product.name }}</h5> <p class="card-text">{{ … -
Can we create a Rest API view using DRF to download a file from server?if yes please share a code snippet
I am trying a way to download log file from server without sharing ssh credentials to all the developers,please help me . I have tried looking for its solutions,and did not get one. -
Django count sub-objects with ntext on SQL Server
I have a Claim object with ClaimAttachment with a simple foreign key. I want to filter Claims that have more than x attachments. Normally, I would just do: Claim.objects.annotate(att_count=Count("attachments")).filter(att_count__gt=5) Easy. Except that Claim has several ntext fields and that results in: django.db.utils.ProgrammingError: ('42000', '[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. (306) (SQLExecDirectW)') That is because Django is making an outer join between Claim and ClaimAttachment and is grouping on all fields from Claim. Several of those fields being ntext, they can't be grouped by. I tried to work around the issue by doing a subquery myself: att = ClaimAttachment.objects.filter(claim_id=OuterRef("id")).aggregate(count=Count("id")) Claim.objects.annotate(att_count=Subquery(att)).filter(att_count__gt=5) But the aggregate cannot be done on the OutRef query. I can move the Count to the annotate(att_count=Count(Subquery(att))) but I'm back to square one because it's trying to group by all fields again. I know that this is not really Django's fault but rather another SQL Server annoyance but I don't control this data model, let alone the database server setup. How can I work around this limitation and get my attachment count ? -
Custom bool icons for Django Admin
I have a bool column in DjangoAdmin which shows the red and green icons like so: The client it's for however is requesting blue and yellow icons since it's what they've been using for years. Is there any way to replace these and use my own custom icons? -
'RuntimeError: populate() isn't reentrant'
I am seeing the following in my logs and my site isn't loading when I visit it. Can anyone tell me how I can fix this? Target WSGI script '/svr/myproject/myproject/wsgi.py' cannot be loaded as Python module. RuntimeError: populate() isn't reentrant [Mon Mar 30 00:09:55.290149 2020] [wsgi:error] [pid 19620] [...] mod_wsgi (pid=19620): Target WSGI script '/svr/myproject/myproject/wsgi.py' cannot be loaded as Python module. [Mon Mar 30 00:09:55.290192 2020] [wsgi:error] [pid 19620] [...] mod_wsgi (pid=19620): Exception occurred processing WSGI script '/svr/myproject/myproject/wsgi.py'. [Mon Mar 30 00:09:55.290211 2020] [wsgi:error] [pid 19620] [...] Traceback (most recent call last): [Mon Mar 30 00:09:55.290231 2020] [wsgi:error] [pid 19620] [...] File "/svr/myproject/myproject/wsgi.py", line 16, in <module> [Mon Mar 30 00:09:55.290270 2020] [wsgi:error] [pid 19620] [...] application = get_wsgi_application() [Mon Mar 30 00:09:55.290279 2020] [wsgi:error] [pid 19620] [...] File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application [Mon Mar 30 00:09:55.290294 2020] [wsgi:error] [pid 19620] [...] django.setup(set_prefix=False) [Mon Mar 30 00:09:55.290302 2020] [wsgi:error] [pid 19620] [...] File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup [Mon Mar 30 00:09:55.290313 2020] [wsgi:error] [pid 19620] [...] apps.populate(settings.INSTALLED_APPS) [Mon Mar 30 00:09:55.290320 2020] [wsgi:error] [pid 19620] [...] File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 78, in populate [Mon Mar 30 00:09:55.290332 2020] [wsgi:error] [pid 19620] [...] raise RuntimeError("populate() isn't reentrant") [Mon Mar 30 … -
Authentication bypassing using browser cookies in Django UI
I have a view in Django which renders html page. I need to do authentication before rendering the page. The link to open this page would be provided in another application built using groovy. On clicking the link, the UI should be rendered directly without any login page. At present I am using the @login_required decorator which opens the login page before rendering the UI. I want to bypass or use another mechanism which would do the authentication without showing the login page. PS: I don't have much knowledge regarding authentication. -
Django URL : Redirect to a url having input from a form
I want the user after its registration, to redirect to a page with URL containing his/her name. I tried passing it as input in urls.py and passing name an variable in the view but its showing name variable insted of the person's name. Please help -
Compare Text and speech
Help me to build a Django project to create a website for word dictation.It is just like a list of words are there .Speak out each word,write it and evaluate. -
Django: Using a loop to output images and text from the db
I'm learning programming and following a tutorial using django 3, the same I'm using. The text and images are not displaying on the frontend on one particular html file. 1.-In settings.py I have this: MEDIA_ROOT= os.path.join(BASE_DIR,"media") MEDIA_URL= "/media/" 2.-In models.py: class Property(models.Model): title = models.CharField(max_length=200) main_photo = models.ImageField(upload_to='photos/%Y/%m/%d/') 3.-In admin.py: from django.contrib import admin from .models import Property class PropertyAdmin(admin.ModelAdmin): list_display = ('id', 'title', 'is_published') list_display_links = ('id', 'title') search_fields = ('title', 'town') list_editable = ('is_published',) list_per_page = 30 admin.site.register(Property, PropertyAdmin) Then I migrated to the DB, I created a properties.html and the loop {{ property.main_photo.url }} or {{ property.title }} is working and getting images and texts on this properties file: {% extends 'base.html' %} {% load humanize %} {% block content %} <section id="showcase-inner" class="py-5 text-white"> <div class="container"> <div class="row text-center"> <div class="col-md-12"> <h1 class="display-4">Browse Our Properties</h1> <p class="lead">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Sunt, pariatur!</p> </div> </div> </div> </section> <!-- Breadcrumb --> <section id="bc" class="mt-3"> <div class="container"> <nav aria-label="breadcrumb"> <ol class="breadcrumb"> <li class="breadcrumb-item"> <a href="{% url 'index' %}"> <i class="fas fa-home"></i> Home</a> </li> <li class="breadcrumb-item active"> All Porperties</li> </ol> </nav> </div> </section> <!-- Listings --> <section id="listings" class="py-4"> <div class="container"> <div class="row"> {% if properties … -
how i can add the attribute of extra_tag in class_based_views in django
how I can add the attribute of extra_tag in class_based_views in django. in normal views we are using like this: messages.success(request, 'Product is added successfully', extra_tags='alert-primary') but in generic views how we can write it? views.py class EditProduct(SuccessMessageMixin, UpdateView): model = Product form_class = EditProductForm success_url = reverse_lazy('stock:stock') template_name = 'stock/editproduct.html' success_message = "Product is updated successfully." def form_valid(self, form): form.instance.saler = self.request.user form.instance.pub_date = timezone.now() return super().form_valid(form) Thank you for your help. -
Communication between Web and android application.(remotely control device)
I develop a website on django framework and a android app on android studio, Now what i want to do is 1- When user click on web button(trace mobile location),the mobile send the current location to the server. 2- click on web button(Ring mobile) the mobile start ringing -
How to test a view that creates a new team (entity) in a database?
I have to unit test my current project and I've hit a roadblock. I'm at 85% coverage and I need to complete this test to go further. Basically, I need to test that my view is able to create a new team in my database. The Team Model is nested under an Organization in the form of a foreign key. models.py - class Organization(models.Model): orgname = models.CharField(max_length = 100, blank=True) def __str__(self): return str(self.orgname) class Team(models.Model): teamID = models.AutoField(primary_key=True) teamName = models.CharField(max_length = 100, blank=True) org = models.ForeignKey(Organization, on_delete=models.CASCADE) def __str__(self): return str(self.teamName) views_admin.py - @csrf_exempt def newTeam(request): if request.method == 'POST': param = json.loads(request.body) orgname = param.get('org') team = param.get('team') org = Organization.objects.get(orgname = orgname) print(org) Team.objects.create(teamName=team, org=org) return JsonResponse({'status':200}) urls.py - path('ajax/newTeam/', views_admin.newTeam, name='ajax_newTeam'), I have tried this so far: def test_newTeam(self): params = {'orgname': REVCYCSCH, 'teamName': 'BLR Scheduling Eng'} response = self.client.post(path = '/ajax/newTeam/', data = params, content_type = 'application/json') self.assertEqual(response.status_code, 200) But I get this error - Error Screenshot -
Django NoReverseMatch Argument
Doesn't find a suitable url from the list(I assume it takes a string for a tuple) NoReverseMatch at /decision/livingrooms/kitchen/ Reverse for 'style' with arguments '('provans',)' not found. 1 pattern(s) tried: ['decision/livingrooms/(?P[-a-zA-Z0-9_]+)/(?P[-a-zA-Z0-9_]+)/$'] Template <ul class="menu menu_interiors"> {% for room in rooms %} <li class="menu__item menu__item_interiors"><a href="{% url 'decision:room' room.slug %}">{{ room.name }}</a></li> {% endfor %} </ul> <ul class="menu menu_styles"> {% for style in styles %} <li class="menu__item menu__item_interiors"><a href="{% url 'decision:style' style.slug %}">{{ style.name }}</a></li> {% endfor %} </ul> urls.py from django.urls import path from .views import ContactView from . import views app_name = 'decision' urlpatterns = [ path('livingrooms/', ContactView.as_view(), name='livingrooms'), path('livingrooms/<slug:rmslg>/', views.room, name='room'), path('livingrooms/<slug:rmslg>/<slug:stslg>/', views.style, name='style'), ] views.py def room(request, rmslg): styles = Room.objects.get(slug=rmslg).styles.all() print(len(styles)) return render(request, 'decision/residentialInteriors.html', {"styles": styles}) def style(request, stslg): style = Style.objects.get(slug=stslg) return render(request, 'decision/residentialInteriors.html', {"style": style}) -
Add a vaiable to each log in python logging
I have received an email through middleware, now I want to add this email in each log that I print using loggings module from different-different files from one place. How can I achieve this? -
Named volume not being created in docker
I'm trying to create a django/nginx/gunicorn/postgres docker-compose configuration. Every time I call docker-compose down, I noticed that my postgres db was getting wiped. I did a little digging, and when I call docker-compose up, my named volume is not being created like i've seen in other tutorials. What am I doing wrong? Here is my yml file (if it helps, I'm using macOS to run my project) version: "3" volumes: postgres: driver: local services: database: image: "postgres:latest" # use latest postgres container_name: database environment: - POSTGRES_USER=REDACTED - POSTGRES_PASSWORD=REDACTED - POSTGRES_DB=REDACTED volumes: - postgres:/postgres ports: - 5432:5432 nginx: image: nginx:latest container_name: nginx ports: - "8000:8000" volumes: - ./src:/src - ./config/nginx:/etc/nginx/conf.d - ./src/static:/static depends_on: - web migrate: build: . container_name: migrate depends_on: - database command: bash -c "python manage.py makemigrations && python manage.py migrate" volumes: - ./src:/src web: build: . container_name: django command: gunicorn Project.wsgi:application --bind 0.0.0.0:8000 depends_on: - migrate - database volumes: - ./src:/src - ./src/static:/static expose: - "8000" -
How do I access template_context_processors?
While developing a website for an online store, I want to access the number of items added to the cart. For this I added the template_context_processors in my settings.py. But it's not showing the number of items. What could be the problem here? My views.py: def cart(request): try: the_id = request.session['cart_id'] except: the_id = None if the_id: cart = Cart.objects.get(id=the_id) context = {"cart":cart} else: empty_message = "Your cart is empty, please keep shopping." context = {"empty": True, "empty_message": empty_message} template = 'shopping_cart/cart.html' return render(request, template, context) def add_to_cart(request, slug): request.session.set_expiry(120000) try: the_id = request.session['cart_id'] except: new_cart = Cart() new_cart.save() request.session['cart_id'] = new_cart.id the_id = new_cart.id cart = Cart.objects.get(id=the_id) try: product = Product.objects.get(slug=slug) except Product.DoesNotExist: raise Http404 except: pass if not product in cart.products.all(): cart.products.add(product) messages.success(request, mark_safe("Product added to cart. Go to <a href='cart/'>cart</a>")) return redirect('myshop-home') else: cart.products.remove(product) messages.success(request, mark_safe("Product removed from cart")) new_total = 0.00 for item in cart.products.all(): new_total += float(item.price) request.session['items_total'] = cart.products.count() cart.total = new_total cart.save() return HttpResponseRedirect(reverse('cart')) Then I added this line of code to my base.html: <a class="nav-item nav-link" href="{% url 'cart' %}">Cart {{ request.session.items_total }}</a> My settings.py: """ Django settings for pyshop project. Generated by 'django-admin startproject' using Django 3.0.3. For more information on … -
Django+AWS(Ubuntu Instance)+uWsgi+Nginx Fatal Python error: ModuleNotFoundError: No module named 'encodings'
I am deploying a django Rest API webservice in AWS and using uwsgi,inginx. Everything worked fine but webiste was not live even after running the serverConnection timed out was displayed in browser. After running this command sudo uwsgi --ini /etc/uwsgi/sites/Ftlabs.ini i got status log which says Python version: 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0] !!! Python Home is not a directory: /home/ubuntu/venv !!! Set PythonHome to /home/ubuntu/venv Fatal Python error: Py_Initialize: Unable to get the locale encoding ModuleNotFoundError: No module named &apos;encodings&apos; Current thread 0x00007f3951cf6740 (most recent call first): Aborted As i am beginner and this is my first deployment.I searched every possible keyword but not happen to find a solution. someone please help me with that. And for reference i was following this blog post Complete Guide to Deploy Django Applications on AWS Ubuntu Instance with uWSGI and Nginx