Re: Django channels on IIS

2019-05-23 Thread Daniel Butler
It looks like I found my key I had to install the application module CGI 
then use this library to get everything to work! 

https://pypi.org/project/wfastcgi/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9b93934c-0650-4817-9982-b4fba1001aa7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels on IIS

2019-05-23 Thread Daniel Butler
Unfortunately

On Thu, May 23, 2019 at 10:09 PM Aldian Fazrihady  wrote:

> IIS still exists?
>
> On Fri, 24 May 2019, 09:04 Daniel Butler,  wrote:
>
>> First off I love this project. Django Channels is amazing!
>>
>> I just wanted to see if anyone has had any success with using iis with
>> Django-Channels since this post over 2 years ago.
>>
>> Thank you!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/55a342a9-e2b8-4fa2-aa9a-7105c946e129%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN7EoAaBvNy5GZer1pG6tuTRqB4BF4aPOyp20mSNmEOFLVnOWA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Daniel Butler

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADbhD6Z%2BkvzR93h-LWH01kN1KdkHVYoCxj%2BW9yfQN7O%2BnOyxtw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels on IIS

2019-05-23 Thread Aldian Fazrihady
IIS still exists?

On Fri, 24 May 2019, 09:04 Daniel Butler,  wrote:

> First off I love this project. Django Channels is amazing!
>
> I just wanted to see if anyone has had any success with using iis with
> Django-Channels since this post over 2 years ago.
>
> Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/55a342a9-e2b8-4fa2-aa9a-7105c946e129%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN7EoAaBvNy5GZer1pG6tuTRqB4BF4aPOyp20mSNmEOFLVnOWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels on IIS

2019-05-23 Thread Daniel Butler
First off I love this project. Django Channels is amazing!

I just wanted to see if anyone has had any success with using iis with 
Django-Channels since this post over 2 years ago.

Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55a342a9-e2b8-4fa2-aa9a-7105c946e129%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Locating web app in mysite directory ?

2019-05-23 Thread Joseph Jones
Hello fellow community members,

I’m working on a Django project using PyCharm on my pc. I’ve run command
‘>py manage.py startapp hypotheticalapp’.
To ensure my app does in fact exist However if I enter into my mysite
directory on file explorer the ‘hypotheticalapp’ file is nowhere to be
found any advice on what error I am making and how to correct it would be
appreciated. Thank you,

Joseph

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJGsC5PLS6jePgmZw%2B4Ei3A%2B2ep%3D5WQJgXbJYJifAibd7zQhdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: My developers have run amok

2019-05-23 Thread Mike Dewhirst

On 23/05/2019 3:30 am, Dan Davis wrote:
Sure - setting it up is easy.   There are hard questions about 
database mutations however.   If you drop column bar from table Fubar, 
then the old code is still querying for buth Fu and Bar:


SELECT id, fu, bar FROM fubar 

On-premise, this is the case for maybe 10 seconds, tops. *In the 
cloud, this could be the case for 30 minutes.*


Are you sure?

My (possibly flawed) understanding is that if you can make the change in 
a single transaction, no-one else can see what is happening until it is 
committed. Effectively that would be an instantaneous change.


Depending on your data architecture you might need to make some parts 
read-only for the 30 minutes prior to committing.




We've decided that this is the developers responsibility, and not the 
responsibility of DevOps CI/CD, just like the developer needs to 
either use cache-busting techniques when changing JS and CSS, or 
educate his users to press Shift-F5 when things go wrong.

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6cd917c1-814d-4839-9849-898ff03618c9%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/641cc740-3b49-7b3d-964a-51b90b0c15b4%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Error during template rendering

2019-05-23 Thread Jim Illback
This error comes when there is a {% url %} tag that is not set up properly - 
like the views.py line highlighted below. So, I suspect you have such a tag say 
tied to a button on the html page, but it isn’t included in this thread.

There’s another error in the code not related to your reverse error - the view 
passes in ‘posts’ as the context name but the template processes ‘post’: 
post.title, post., etc. Those have to match in order for the DB values to 
be displayed.

I’d go back through the djangogirls tutorial again and be positive everything 
is typed in correctly. That should fix it.

Jim

On May 23, 2019, at 12:23 PM, cixtus anyanwu 
mailto:sikky...@gmail.com>> wrote:

Still got this erorr. thanks
  File 
"C:\Users\ANYANWU\djangogirls\myvenv\lib\site-packages\django\urls\resolvers.py",
 line 634, in _reverse_with_prefix
raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'post_details' with keyword 
arguments '{'pk': 3}' not found. 1 pattern(s) tried: ['posts//$']

On Thursday, May 23, 2019 at 7:29:57 PM UTC+1, subaru_87 wrote:
Below, post is a DB row, not an ID as the URL.py requires.

Change the view as:
return render(request, ‘blog/post_details.html’, {‘pk’: posts[‘id’]})


Jim


On May 23, 2019, at 11:10 AM, Rock N Roll Mühlbacher  
wrote:

Am Donnerstag, 23. Mai 2019 20:06:31 UTC+2 schrieb cixtus anyanwu:
Guys am following the django girls pdf tutoril but am stuck here. Its saying:



django.urls.exceptions.NoReverseMatch: Reverse for 'post_details' with keyword 
arguments '{'pk': 3}' not found. 1 pattern(s) tried: ['posts//$']
[23/May/2019 18:13:22] "GET / HTTP/1.1" 500 153773
my views.py is below:




from django.shortcuts import render, get_object_or_404
from django.utils import timezone
from .models import Post


# Create your views here.
def post_list(request):
 posts = Post.objects.filter(title__contains='post')
 return render(request, 'blog/post_list.html', {'posts':posts})
def post_details(request, pk):
 posts = get_object_or_404(Post, pk)
 return render(request, 'blog/post_details.html', {'posts': posts})




urls.py




from django.urls import path
from . import views


urlpatterns = [
 path('', views.post_list, name='post_list'),
 path('posts//', views.post_details, name='post_details')
]




base.html




{% load static %}


 Django reloaded
 


 Django Girls Blog 
 {% block content %}
 {% endblock %}






post_details.html




{% extends 'blog/base.html' %}
{% block content %}
 {% if post.published_date %}
 {{post.title}}
 {% endif %}
 
 {{post.body}}
 {{post.published_date}}
 
 }
{% endblock %}




I have tried everything i can. Pls help me out guys.

--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django...@googlegroups.com.
To post to this group, send email to djang...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/92d0fe6d-dc88-4423-9645-402284ac9877%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com.
To post to this group, send email to 
django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0a4369bc-2538-4bf7-aaf7-b09be339abec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/EB225128-BE1F-47A7-A59A-834978468BBC%40hotmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error during template rendering

2019-05-23 Thread cixtus anyanwu
Still got this erorr. thanks
  File 
"C:\Users\ANYANWU\djangogirls\myvenv\lib\site-packages\django\urls\resolvers.py",
 
line 634, in _reverse_with_prefix
raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'post_details' with 
keyword arguments '{'pk': 3}' not found. 1 pattern(s) tried: 
['posts//$']

On Thursday, May 23, 2019 at 7:29:57 PM UTC+1, subaru_87 wrote:
>
> Below, post is a DB row, not an ID as the URL.py requires.  
>
> Change the view as:
> return render(request, ‘blog/post_details.html’, {‘pk’: posts[‘id’]})
>
>
> Jim
>
>
> On May 23, 2019, at 11:10 AM, Rock N Roll Mühlbacher  > wrote:
>
> Am Donnerstag, 23. Mai 2019 20:06:31 UTC+2 schrieb cixtus anyanwu:
>
> Guys am following the django girls pdf tutoril but am stuck here. Its 
> saying:
>
>
>
> django.urls.exceptions.NoReverseMatch: Reverse for 'post_details' with 
> keyword arguments '{'pk': 3}' not found. 1 pattern(s) tried: 
> ['posts//$']
> [23/May/2019 18:13:22] "GET / HTTP/1.1" 500 153773 
> my views.py is below:
>
>
>
>
> from django.shortcuts import render, get_object_or_404
> from django.utils import timezone
> from .models import Post
>
>
> # Create your views here.
> def post_list(request):
>  posts = Post.objects.filter(title__contains='post')
>  return render(request, 'blog/post_list.html', {'posts':posts})
> def post_details(request, pk):
>  posts = get_object_or_404(Post, pk)
>  return render(request, 'blog/post_details.html', {'posts': posts})
>
>
>
>
> urls.py
>
>
>
>
> from django.urls import path
> from . import views
>
>
> urlpatterns = [
>  path('', views.post_list, name='post_list'),
>  path('posts//', views.post_details, name='post_details')
> ]
>
>
>
>
> base.html
>
>
>
>
> {% load static %}
> 
> 
>  Django reloaded
>  
> 
> 
>  Django Girls Blog 
>  {% block content %}
>  {% endblock %}
> 
> 
>
>
>
>
> post_details.html
>
>
>
>
> {% extends 'blog/base.html' %}
> {% block content %}
>  {% if post.published_date %}
>  {{post.title}}
>  {% endif %}
>  
>  {{post.body}}
>  {{post.published_date}}
>  
>  }
> {% endblock %}
>
>
>
>
> I have tried everything i can. Pls help me out guys.
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django...@googlegroups.com .
> To post to this group, send email to djang...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/92d0fe6d-dc88-4423-9645-402284ac9877%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0a4369bc-2538-4bf7-aaf7-b09be339abec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error during template rendering

2019-05-23 Thread Jim Illback
Below, post is a DB row, not an ID as the URL.py requires.

Change the view as:
return render(request, ‘blog/post_details.html’, {‘pk’: posts[‘id’]})


Jim


On May 23, 2019, at 11:10 AM, Rock N Roll Mühlbacher 
mailto:chmuhlbache...@gmail.com>> wrote:

Am Donnerstag, 23. Mai 2019 20:06:31 UTC+2 schrieb cixtus anyanwu:
Guys am following the django girls pdf tutoril but am stuck here. Its saying:



django.urls.exceptions.NoReverseMatch: Reverse for 'post_details' with keyword 
arguments '{'pk': 3}' not found. 1 pattern(s) tried: ['posts//$']
[23/May/2019 18:13:22] "GET / HTTP/1.1" 500 153773
my views.py is below:




from django.shortcuts import render, get_object_or_404
from django.utils import timezone
from .models import Post


# Create your views here.
def post_list(request):
 posts = Post.objects.filter(title__contains='post')
 return render(request, 'blog/post_list.html', {'posts':posts})
def post_details(request, pk):
 posts = get_object_or_404(Post, pk)
 return render(request, 'blog/post_details.html', {'posts': posts})




urls.py




from django.urls import path
from . import views


urlpatterns = [
 path('', views.post_list, name='post_list'),
 path('posts//', views.post_details, name='post_details')
]




base.html




{% load static %}


 Django reloaded
 


 Django Girls Blog 
 {% block content %}
 {% endblock %}






post_details.html




{% extends 'blog/base.html' %}
{% block content %}
 {% if post.published_date %}
 {{post.title}}
 {% endif %}
 
 {{post.body}}
 {{post.published_date}}
 
 }
{% endblock %}




I have tried everything i can. Pls help me out guys.

--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com.
To post to this group, send email to 
django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/92d0fe6d-dc88-4423-9645-402284ac9877%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6941BD09-766A-4793-8F9F-0AC9890EA343%40hotmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error during template rendering

2019-05-23 Thread Rock N Roll Mühlbacher
Am Donnerstag, 23. Mai 2019 20:06:31 UTC+2 schrieb cixtus anyanwu:
> Guys am following the django girls pdf tutoril but am stuck here. Its saying:
> 
> 
> 
> django.urls.exceptions.NoReverseMatch: Reverse for 'post_details' with 
> keyword arguments '{'pk': 3}' not found. 1 pattern(s) tried: ['posts/ pk>/$']
> [23/May/2019 18:13:22] "GET / HTTP/1.1" 500 153773 
> my views.py is below:
> 
> 
> 
> 
> from django.shortcuts import render, get_object_or_404
> from django.utils import timezone
> from .models import Post
> 
> 
> # Create your views here.
> def post_list(request):
>  posts = Post.objects.filter(title__contains='post')
>  return render(request, 'blog/post_list.html', {'posts':posts})
> def post_details(request, pk):
>  posts = get_object_or_404(Post, pk)
>  return render(request, 'blog/post_details.html', {'posts': posts})
> 
> 
> 
> 
> urls.py
> 
> 
> 
> 
> from django.urls import path
> from . import views
> 
> 
> urlpatterns = [
>  path('', views.post_list, name='post_list'),
>  path('posts//', views.post_details, name='post_details')
> ]
> 
> 
> 
> 
> base.html
> 
> 
> 
> 
> {% load static %}
> 
> 
>  Django reloaded
>  
> 
> 
>  Django Girls Blog 
>  {% block content %}
>  {% endblock %}
> 
> 
> 
> 
> 
> 
> post_details.html
> 
> 
> 
> 
> {% extends 'blog/base.html' %}
> {% block content %}
>  {% if post.published_date %}
>  {{post.title}}
>  {% endif %}
>  
>  {{post.body}}
>  {{post.published_date}}
>  
>  }
> {% endblock %}
> 
> 
> 
> 
> I have tried everything i can. Pls help me out guys.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/92d0fe6d-dc88-4423-9645-402284ac9877%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1 project, X app = X subdomains (Django, Apache)

2019-05-23 Thread Aldian Fazrihady
Official way:
1. Run separate wsgi process for each subdomain. Each wsgi process uses
unique Unix or TCP socket.
2. Each wsgi process uses its own Django settings that points to the
specific app's urls.py
3. The web server configuration for each subdomain points to the socket of
the Django app representing that subdomain.

Unofficial way:
Create path rewriting rule in wsgi configuration.

I have used those both ways in the past. If your machine has very limited
RAM,  such as 1 GB or below that,  I suggest you to try the second way.


Regards,

Aldian Fazrihady
https://www.aldianfazrihady.com/en-us/

On Thu, 23 May 2019, 21:53 Jakub Jiřička,  wrote:

> Hi,
>
> I want to ask you if someone has solved how to prove that is possible the
> applications in one project run in different subdomains?
>
> I have 1 project (projekt.cz) and provide of 3 applications (app1, app2,
> app3) and I would like to get on my vps (CentOS, Apache, PostgreSQL,
> Django) app1.projekt.cz app2.projekt.cz and app3.projekt.cz
>
> I searched everywhere and I found only django-subdomains and
> django-domains ... unfortunately, I have not managed to get started,
> because out-of-date ...
>
> So, there is someone who can help me with settings Django for this
> task/problem?
>
> Many thanks and regards
> Jakub
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0d2ddb92-5aec-4155-9071-d8c3a69ebee6%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN7EoAbNGEhsemXw6VV%2BPu3uvSTsRpX%2Bo2Y4AOJBicCcv%3DpAsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Error during template rendering

2019-05-23 Thread cixtus anyanwu
Guys am following the django girls pdf tutoril but am stuck here. Its 
saying:

django.urls.exceptions.NoReverseMatch: Reverse for 'post_details' with 
keyword arguments '{'pk': 3}' not found. 1 pattern(s) tried: 
['posts//$']
[23/May/2019 18:13:22] "GET / HTTP/1.1" 500 153773 
*my views.py is below:*

from django.shortcuts import render, get_object_or_404
from django.utils import timezone
from .models import Post


# Create your views here.
def post_list(request):
 posts = Post.objects.filter(title__contains='post')
 return render(request, 'blog/post_list.html', {'posts':posts})
def post_details(request, pk):
 posts = get_object_or_404(Post, pk)
 return render(request, 'blog/post_details.html', {'posts': posts})


*urls.py*

from django.urls import path
from . import views


urlpatterns = [
 path('', views.post_list, name='post_list'),
 path('posts//', views.post_details, name='post_details')
]


*base.html*

{% load static %}


 Django reloaded
 


 Django Girls Blog 
 {% block content %}
 {% endblock %}




*post_details.html*

{% extends 'blog/base.html' %}
{% block content %}
 {% if post.published_date %}
 {{post.title}}
 {% endif %}
 
 {{post.body}}
 {{post.published_date}}
 
 }
{% endblock %}


I have tried everything i can. Pls help me out guys.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4be9ce2e-13ad-4782-b33a-197cf4c2610c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1 project, X app = X subdomains (Django, Apache)

2019-05-23 Thread Tim Chase
On 2019-05-23 06:22, Jakub Jiřička wrote:
> I want to ask you if someone has solved how to prove that is
> possible the applications in one project run in different
> subdomains?
>
> I have 1 project (projekt.cz) and provide of 3 applications (app1,
> app2, app3) and I would like to get on my vps (CentOS, Apache,
> PostgreSQL, Django) app1.projekt.cz app2.projekt.cz and
> app3.projekt.cz

I can read two interpretations of what what you describe:

1) each application is distinct/independent and you want each one to
run on its own subdomain.  This seems like the most sensible
interpretation and is fairly straightforward:  you configure your
web server (apache, from your description) to farm out different
subdomains:

  
   ServerName app1.example.com
   DocumentRoot /var/www/vhosts/app1
   WSGIScriptAlias / /var/www/vhosts/app1/myproject1/wsgi.py
   ⋮
  
  
   ServerName app2.example.com
   DocumentRoot /var/www/vhosts/app2
   WSGIScriptAlias / /var/www/vhosts/app2/myproject2/wsgi.py
   ⋮
  

with the relevant configuration in each block.


2) if you want to run the same Django code, backing multiple
subdomains with the same codebase, you want a wildcard subdomain
pointed at 

  
   ServerAlias *.example.com
   ⋮
  

and then sniff the Host: HTTP header which something like
django-subdomains helps to make easier.

> I searched everywhere and I found only django-subdomains and
> django-domains ... unfortunately, I have not managed to get
> started, because out-of-date 

I'm not sure what you mean by "because out-of-date".  While
they both appear to have been last updated in 2016, I imagine they
got to the point where they just worked and didn't need much more
care & feeding.  I'd assume they're fine unless you hit an issue with
them.

-tkc











-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20190523123847.3561d870%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.


Re: Write urls without regex in DRF

2019-05-23 Thread nm
Yes, it's possible to write this code without using regexp, and it should 
work the same.

If you have a look at the source code of the routers, there's a method 
`get_urls` in SimpleRouter (you can find it here 
https://github.com/encode/django-rest-framework/blob/master/rest_framework/routers.py),
 
which, among others, does:

regex = route.url.format(
prefix=prefix,
lookup=lookup,
trailing_slash=self.trailing_slash
)


where `route.url` is something like 

url=r'^{prefix}/{lookup}{trailing_slash}$',


and `prefix` is the first argument you pass to `router.register` - in your 
case, an empty string:

def register(self, prefix, viewset, basename=None, base_name=None)


It does not seem to matter whether you put `prefix=r''` or `prefix=''`, the 
ultimate url regex looks the same.
Disclaimer: I assume you're using the latest version of DRF (3.9.x); I 
haven checked how the code looks in older versions. 

On Wednesday, 22 May 2019 17:20:20 UTC+2, Rounak Jain wrote:

>
> I am using DRF Viewsets to auto-generate URLs for different views. Is it 
> possible to write the code below without using regex?
> Thanks
>
> from .views import TaskViewSet
> from rest_framework.routers import DefaultRouter
>
> router = DefaultRouter()
> router.register(r'', TaskViewSet, basename='task')
> urlpatterns = router.urls
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e929c4c9-a174-434d-bda9-9000e5cf8892%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


1 project, X app = X subdomains (Django, Apache)

2019-05-23 Thread Jakub Jiřička
Hi,

I want to ask you if someone has solved how to prove that is possible the 
applications in one project run in different subdomains?

I have 1 project (projekt.cz) and provide of 3 applications (app1, app2, 
app3) and I would like to get on my vps (CentOS, Apache, PostgreSQL, 
Django) app1.projekt.cz app2.projekt.cz and app3.projekt.cz

I searched everywhere and I found only django-subdomains and django-domains 
... unfortunately, I have not managed to get started, because out-of-date 
...

So, there is someone who can help me with settings Django for this 
task/problem?

Many thanks and regards
Jakub

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0d2ddb92-5aec-4155-9071-d8c3a69ebee6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to report data migration error?

2019-05-23 Thread Victor Porton
Which exception should be raised if my data migration code finds that the 
data in the DB has a logical error and cannot be migrated for this reason?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/68a6d93a-876f-4a5b-b018-5955d891ebbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Show different views based on user

2019-05-23 Thread Enderson Menezes
>From what I've seen you're using a Django Filters framework or REST 
Framework, if so, in my opinion I would develop two API's and control their 
access to the constraints which would make them secure. One of these apis 
would make one general query and the other specific.

Em quarta-feira, 22 de maio de 2019 21:39:23 UTC-3, Rounak Jain escreveu:
>
> I am new to Django. Below code returns objects created by the logged in 
> user. If the user's role property has value 'super', then I want all the 
> objects to be shown. If the user's role property is 'inter', then I want to 
> show all objects except objects created by 'super'. Where is the right 
> place to do this conditional querying?
> Thanks
>
> #views.py
>
> class TaskViewSet(ModelViewSet):
> serializer_class = TaskSerializer
> def get_queryset(self):
> return Task.objects.all().filter(created_by=self.request.user)
> def perform_create(self, serializer):
> serializer.save(created_by=self.request.user)
>
> #serializers.py
>
> class TaskSerializer(ModelSerializer):
>
> class Meta:
> model = Task
> fields = ('id', 'name', 'status', 'created_by')
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6842bc37-1870-437f-ab19-03d3e1cd3ab0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create a login form with two more forms in it

2019-05-23 Thread laurine ogutu
Thank you all

On Wed, May 15, 2019, 2:55 PM arun ashok 
> https://www.codementor.io/lakshminp/handling-multiple-forms-on-the-same-page-in-django-fv89t2s3j
>  this
> will get you some idea about loading  multiple forms in a temlate.If  you
> want to hide the forms related to button click,add the forms in different
> div's,use java script to hide or display the form divs according to the
> buttons
> On Monday, May 13, 2019 at 5:04:13 PM UTC+5:30, laurine ogutu wrote:
>>
>> Hi i have tried to create a login form where a teacher and student can
>> login. Once the teacher clicks the teachers button, they can give their
>> details. Once a student clicks the student button, they can give their
>> details different from the teachers. I have a problem getting it done.
>> Kindly help
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/430caf1b-3a13-46a7-8db4-58ec41fbd5ed%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPqJkvvN-A%3Dj7D%3D_8GteD0BgM9wBiRjewifFR5TognSiu%2BXTyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Show different views based on user

2019-05-23 Thread Balaji Shetty
HI

Consider this example and you may get the solution

  Model name is Profile and in admin.py   override this
def get_form(self, request, obj=None, **kwargs):


-
admin.py

from django.contrib.auth.models import User

class ProfileAdmin(admin.ModelAdmin):

 def get_form(self, request, obj=None, **kwargs):

username = request.user.username   # code to extract property
print (username)

if username == "dgp":  #dgp is username
   self.exclude = ("CaseAdvocate","CaseActionTaken", )#
"CaseAdvocate","CaseActionTaken",are column names
   form = super(ProfileAdmin, self).get_form(request, obj, **kwargs)
   return form
else:
   form = super(ProfileAdmin, self).get_form(request, obj, **kwargs)
   return form

Replace dgp with your own username and write the query.
Here i am excluding "CaseAdvocate","CaseActionTaken" Columns in display for
"dgp" user
and showing all colums to other user



On Thu, May 23, 2019 at 6:08 AM Rounak Jain  wrote:

> I am new to Django. Below code returns objects created by the logged in
> user. If the user's role property has value 'super', then I want all the
> objects to be shown. If the user's role property is 'inter', then I want to
> show all objects except objects created by 'super'. Where is the right
> place to do this conditional querying?
> Thanks
>
> #views.py
>
> class TaskViewSet(ModelViewSet):
> serializer_class = TaskSerializer
> def get_queryset(self):
> return Task.objects.all().filter(created_by=self.request.user)
> def perform_create(self, serializer):
> serializer.save(created_by=self.request.user)
>
> #serializers.py
>
> class TaskSerializer(ModelSerializer):
>
> class Meta:
> model = Task
> fields = ('id', 'name', 'status', 'created_by')
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANNuxWPeGAgGEikRkoYgdp%3Dse9W0MBVxsLwac1W_BJw0%3DtmGOg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 


*Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
*SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
*Official: bsshe...@sggs.ac.in  *
*  Mobile: +91-9270696267*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAECSbOvdAnRf3o_2qefcpET3bA03o7tQFzndEQrWV%3DjLA9h7zg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Display data from the news api json

2019-05-23 Thread Enderson Menezes
If you have the api running, and in the browser you get the display of your 
data. Your problem is not about django is about a language or a framework 
to program mobile.

Em quinta-feira, 23 de maio de 2019 10:06:12 UTC-3, Thiago brayo escreveu:
>
> I have been using the news api to fetch articles. Have the json data but I 
> cant seem to figure out how to display it on my app. Any help will be 
> appreciated.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/57183c58-b923-44ee-be5c-66bc4c779c5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Display data from the news api json

2019-05-23 Thread Thiago brayo
I have been using the news api to fetch articles. Have the json data but I 
cant seem to figure out how to display it on my app. Any help will be 
appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/283d907b-961f-47da-b7f7-9ee69f2b6ca6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Filtering Data Based On Foreign Key

2019-05-23 Thread Simon A
Have you tried putting the load_price() code inside the init code? like

def __init__(self, *args, **kwargs):
super(PlayerRegistrationForm, self).__init__(*args, **kwargs)
self.fields['club_id'].widget = forms.HiddenInput()

membership = request.GET.get('membership_title')
title = ClubMemberships.objects.filter(title=membership)
self.fields['price'].queryset = 
ClubMemberships.objects.filter(price=title.price)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e032daa3-4ccc-427c-bb6d-fd306b1ac88b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: some random problem

2019-05-23 Thread Simon A
share the code here. I know django devs are lazy but don't be this lazy.

On Wednesday, May 22, 2019 at 8:07:08 PM UTC+8, Soumen Khatua wrote:
>
> Hi Folks,
>
> I'm getting len(cart) is 0 and after iterate *item is not coming from 
> cart* in this project,plese tell me where is my problem.
> I'm sharing my git repo please go through it and please tell me the what i 
> missed.It's urgent.
>
> Here is the link:
> https://github.com/Herosoumen/clothproject 
>
>
> Thank you
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3f62cdd5-6a3c-4577-88cc-f27d6016ae26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Dealing with global or session objects

2019-05-23 Thread Simon A
Hello fellow Java user,

If I would do it, I'd setup a model to store those configurations.

Then on the app, upon login or upon loading the initial page of the app, I 
will perform the operation to retrieve the details from the database, and 
then dump to the django sessions object.

# get operation
request.session.get('key', None)


# set operation
self.request.session['key'] = value

Please also see https://docs.djangoproject.com/en/2.2/topics/http/sessions/ for 
more information.

Regards,
Simon.

On Wednesday, May 22, 2019 at 9:26:15 PM UTC+8, Jean-Noël Colin wrote:
>
> Hi, 
>
> I'm coming from a java world, where there exists different scopes for 
> objects: application-, session-, request scopes all define different 
> lifecycle for objects. I have some difficulties in finding an equivalent 
> approach in Django. 
>
> Here's the need: my project stores its custom configuration in the 
> database, for persistence; these parameters can be changed by an 
> administrator only, through a custom view/form. However, those parameters 
> are used in many views in the project, in read-only mode. So my idea would 
> be to have one single object, that stores the parameter values, that is 
> initialized when the application starts, that can be read at any time 
> without requiring reading from the DB, and that, when modified by admin, 
> would be saved to the db. How to plug this in the django architecture? 
>
> Thanks a lot
>
> Jean-Noël
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/da5dd8d8-e1a3-44cc-8f44-158f4183a99e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.