Re: Static files won't match the path given

2019-05-10 Thread Rookies DJ
Dear Anirudh Jain

Thank you for reply 

Really, apprentice it

Yes we run collectstaitc command 

And we try within setting.py files

Set path static_root/url as the same

As for web server software we using apache not nigx.

I apologize for not including this information

Really appreciate if you could 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/efd7bdbc-4c67-4166-88f0-c6e9b245b267%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Static files won't match the path given

2019-05-10 Thread Rookies DJ
I apologise, I'm a hardware engineer, I'm not very familiar with coding; 
I'm only on Django for the past 5 months. (under my boss order)

I had managed to develop and establish a Django App, and manage to upload 
it to remote server *NameCheap*. There on the server, the issue is unable 
to locate the static files. Even when we directed the path to static files 
folder.

This static files, infrequently work and load the static, that's how we 
concluded the static error was caused by the misdirection of the path.

But reading over the Django documentary multiple time didn't help resolve 

Please help our team had been trying resolve this issue for past 2months 

-- 
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/e2f33470-0ad3-4387-9fbe-cd20b40eee82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django, mod_wsgi and apache2.4 = 403 forbidden

2019-01-28 Thread Rookies DJ
I'm sorry if I'm asking the repetitive but i really need assistance I been 
trying to setup a server for my company system but I had no progress. 

As the tile subject mention the I'm Using Mod_wsgi 4.6.5 and Apache 2.4

for my Django is 2.1 and python 3.7

When try to run on my local machine I get 403 and I did many google search 
and the only answer I get is add in Require all granted which I had already 
add in. you could see below for particle section for my Apache http

LoadModule wsgi_module 
"C:\users\user\appdata\local\programs\python\python37\lib\site-packages/mod_wsgi/server/mod_wsgi.cp37-win_amd64.pyd"
WSGIScriptAlias / "C:\Frontier_Website\FrounterWebApp\FrounterWeb\wsgi.py"\
WSGIPythonPath "C:\Frontier_Website\FrounterWebApp\zigview"
WSGIPythonHome "C:\Users\user\AppData\Local\Programs\Python\Python37"


Require all granted




Require all granted




for more detail you can look at at code in stackoverflow.com:
 
https://stackoverflow.com/questions/54249683/django-mod-wsgi-and-apache2-4-problems
  
I had try to run the system in virtualenv but I get no result as well and 
when I try to start the server, I get this error: *The system cannot find 
the path specified.*
The virtualenv code is below;

#python and mod_wsgi setting 

 ServerName Localhost.com 
 DocumentRoot 
C:\Frontier_Website\FATWebsite\FrontierWebApp\zigview\templates\FrounterWeb
LoadModule wsgi_module 
C:\users\user\appdata\local\programs\python\python37\lib\site-packages/mod_wsgi/server/mod_wsgi.cp37-win_amd64.pyd
WSGIScriptAlias / 
C:\Frontier_Website\FATWebsite\FrontierWebApp\FrounterWeb\wsgi.py
WSGIPythonHome C:\Frontier_Website\FATWebsite\Lib
WSGIPythonPath C:\Frontier_Website\FrounterWebApp\zigview

Alias /static \Frontier_Website\FATWebsite\FrounterWebApp\zigview\static

Require all granted




   Require all granted



 
 
Please help I had been trying to solve this problem for month now

-- 
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/c95e4fd6-bf77-4da9-8745-39f36c97b38b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


custom filter tag I can't get to work

2018-12-05 Thread Rookies DJ
I create my own custom filter tags to using in my project but every time i 
put in my HTML it just product this errors Invalid filter:

I don't where i do wrong, I try putting the {%load tag%} with child 
templates, it didn't work 

I try name it differently 

@register.filter("multiply", multiply) @register.filter(name="multiply") 
@register.filter() 

didn't work either 

Here my HTML code that include the filter:


   
   PH:
{{tank_system.PH|latest}}, 

   



and here my code for my custom filter


from django import template
register = template.Library()

@register.filter('latest', latest)
def custom_last(value):
last = None

try:
last = value[-1]
except AssertionError:
try:
last = value.reverse()[0]
except IndexError:
pass

return last


my views


from django.shortcuts import render
from django.views.generic import TemplateView
from zigview.models import tank_system

from django.contrib.auth.decorators import login_required
import logging
logger = logging.getLogger(__name__)


try:
@login_required(login_url='/accounts/login/')
def index(request): #gose to main dashboard page
tank = tank_system.objects.all
return render(request, 'FrounterWeb/extends/includes.html', 
{'tank': tank})
except:
logger.error('index page request failed/errors')


I intend to use two custom filter

-- 
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/97860011-3621-4c46-b654-67a9c95d33af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why I can't pass anything to my html? Django 2.1

2018-11-17 Thread Rookies DJ
*Answer:*

Hi everyone Thanks for helping me but I found out my mistake and the cause 
of the problems; 
The problems are my URL, is not calling my def in views 


On Monday, 12 November 2018 20:13:21 UTC+8, Rookies DJ wrote:
>
> I been trying 2 weeks on trying to pass variables form Django views into 
> html, but every time I run my code, it works but it doesn't display the 
> variable I see 
>
> from django.shortcuts import render
> from zigview.models import tank_system
>
> def index(request):
> return render(request,'FrounterWeb/includes.html')
>
> def login(requset):
> return render(requset, 'FrounterWeb/login.html')
>
>
> def timedex(requset):
> tank = tank_system.object.get(id(5))
> print(tank)
> return render(requset, "FrounterWeb/body.html",tank)
>
>
> Here my models
>
> from django.db import models
>
>
> class user(models.Model):
> username = models.CharField(max_length=50)
> password = models.CharField(max_length=50)
>
>
> class tank_system(models.Model):
> Ph = models.DecimalField(max_digits=2, decimal_places=1)
> EC = models.DecimalField(max_digits=2, decimal_places=1)
> temp = models.DecimalField(max_digits=2, decimal_places=0)
> level = models.IntegerField(primary_key=True, default=0)
> data = models.DateTimeField(auto_now=True)
>
>
> Here my HTML that i try pass variable in 
>
> 
> 
>   Time
>   Tank level
>   EC
>   pH
>   room temptures
>   Water temptrure
> 
> 
>   22.30
>   900 lits
>   {{tank}}
>   7.3
>   {{tank}}
>   24
> 
>
> 
>
>
> My HTML body structures
>
> Web
>
> ├── templates
> │   ├── index.hmtl
> │   │   └── includes
> │   ├── body.hml
> │   ├── header.html
>
>   This my urls files;
>
> from django.contrib import admin
> from django.urls import include, path
> from django.views.generic.base import TemplateView
>
> urlpatterns = [
> path(r'^admin/$', admin.site.urls),
> path('account', include('django.contrib.auth.urls')),
> path('', include('zigview.urls')),
> path(r'', TemplateView.as_view(template_name='index.html'), name = 
> 'myapp'),
> ]
>
>

-- 
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/a037ca51-72fe-40d8-ab62-b1e7cd56f676%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why I can't pass anything to my html? Django 2.1

2018-11-14 Thread Rookies DJ
Hi Amit pant

I'm sorry how do that (make dictionary for display variables using html)

Maybe you could give me some sample code?



On Monday, 12 November 2018 23:39:26 UTC+8, amit pant wrote:
>
> you need to make dictionary for display variables using html
>
> On Mon, Nov 12, 2018 at 6:57 PM Cuneyt Mertayak  > wrote:
>
>> vvv Typo: read "context" instead of "content" vvv
>>
>> On Monday, November 12, 2018 at 5:26:48 AM UTC-8, Cuneyt Mertayak wrote:
>>>
>>> The content for the `render` method is supposed to be a dictionary: 
>>> https://docs.djangoproject.com/en/2.1/topics/http/shortcuts/#optional-arguments
>>>
>>> So change it to this render(requset, "FrounterWeb/body.html",{'tank': 
>>> tank})
>>>
>>> Also in the template file you want to display the properties of the ORM 
>>> (tank_system) object I guess, change them to {{tank.EC}}, 
>>> {{tank. temp}}, respectively.
>>>
>>> Hope it helps!
>>>
>>> On Monday, November 12, 2018 at 4:13:21 AM UTC-8, Rookies DJ wrote:
>>>>
>>>> I been trying 2 weeks on trying to pass variables form Django views 
>>>> into html, but every time I run my code, it works but it doesn't display 
>>>> the variable I see 
>>>>
>>>> from django.shortcuts import render
>>>> from zigview.models import tank_system
>>>>
>>>> def index(request):
>>>> return render(request,'FrounterWeb/includes.html')
>>>>
>>>> def login(requset):
>>>> return render(requset, 'FrounterWeb/login.html')
>>>>
>>>>
>>>> def timedex(requset):
>>>> tank = tank_system.object.get(id(5))
>>>> print(tank)
>>>> return render(requset, "FrounterWeb/body.html",tank)
>>>>
>>>>
>>>> Here my models
>>>>
>>>> from django.db import models
>>>>
>>>>
>>>> class user(models.Model):
>>>> username = models.CharField(max_length=50)
>>>> password = models.CharField(max_length=50)
>>>>
>>>>
>>>> class tank_system(models.Model):
>>>> Ph = models.DecimalField(max_digits=2, decimal_places=1)
>>>> EC = models.DecimalField(max_digits=2, decimal_places=1)
>>>> temp = models.DecimalField(max_digits=2, decimal_places=0)
>>>> level = models.IntegerField(primary_key=True, default=0)
>>>> data = models.DateTimeField(auto_now=True)
>>>>
>>>>
>>>> Here my HTML that i try pass variable in 
>>>>
>>>> 
>>>> 
>>>>   Time
>>>>   Tank level
>>>>   EC
>>>>   pH
>>>>   room temptures
>>>>   Water temptrure
>>>> 
>>>> 
>>>>   22.30
>>>>   900 lits
>>>>   {{tank}}
>>>>   7.3
>>>>   {{tank}}
>>>>   24
>>>> 
>>>>
>>>> 
>>>>
>>>>
>>>> My HTML body structures
>>>>
>>>> Web
>>>>
>>>> ├── templates
>>>> │   ├── index.hmtl
>>>> │   │   └── includes
>>>> │   ├── body.hml
>>>> │   ├── header.html
>>>>
>>>>   This my urls files;
>>>>
>>>> from django.contrib import admin
>>>> from django.urls import include, path
>>>> from django.views.generic.base import TemplateView
>>>>
>>>> urlpatterns = [
>>>> path(r'^admin/$', admin.site.urls),
>>>> path('account', include('django.contrib.auth.urls')),
>>>> path('', include('zigview.urls')),
>>>> path(r'', TemplateView.as_view(template_name='index.html'), name = 
>>>> 'myapp'),
>>>> ]
>>>>
>>>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/0ccdcf5d-1d90-41e4-be33-f3684dace2b1%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/0ccdcf5d-1d90-41e4-be33-f3684dace2b1%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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/b6acf5ff-b2cb-4769-bdf0-67e7b5104bcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why I can't pass anything to my html? Django 2.1

2018-11-13 Thread Rookies DJ
Hi Omar Abou Mrad thanks for helping me,
 
Please read the ones in red:

What are you seeing?
My Web page as I want but, i'm missing the key value form my database

What errors do you get?
no errors everything working fine

in summary i'm not having any errors but i can't see anything form my 
database 

My project goal is retrieve a data form the database and display on web-page

But i can't pass any value form my database into my html page

Thanks help Omar Abou Mrad


On Tuesday, 13 November 2018 17:07:47 UTC+8, Omar Abou Mrad wrote:
>
> We would require more information;
> What errors do you get?
> What are you seeing?
>
> Either way, this is not correct: tank = tank_system.object.get(id(5))
> It should be: tank = tank_system.object.get(id=5)
>
> I suggest going through the django tutorial if you haven't already.
>
> On Tue, Nov 13, 2018 at 10:29 AM Rookies DJ  > wrote:
>
>>
>>
>> On Monday, 12 November 2018 21:26:48 UTC+8, Cuneyt Mertayak wrote:
>>>
>>> The content for the `render` method is supposed to be a dictionary: 
>>> https://docs.djangoproject.com/en/2.1/topics/http/shortcuts/#optional-arguments
>>>
>>> So change it to this render(requset, "FrounterWeb/body.html",{'tank': 
>>> tank})
>>>
>>> Also in the template file you want to display the properties of the ORM 
>>> (tank_system) object I guess, change them to {{tank.EC}}, 
>>> {{tank. temp}}, respectively.
>>>
>>> Hope it helps!
>>>
>>
>> Thx for help
>> Cuneyt Mertayak
>>
>>  but it didn't work, appreciate the reply, but suspect that the whiten 
>> the request to return there nothing, is the whole code become empty, that 
>> my believes 
>>  
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/45d9f4af-4807-4692-8d6e-dcc7ab14818a%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/45d9f4af-4807-4692-8d6e-dcc7ab14818a%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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/40fc4541-5242-4b21-897e-b064bcde519b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why I can't pass anything to my html? Django 2.1

2018-11-13 Thread Rookies DJ


On Monday, 12 November 2018 21:26:48 UTC+8, Cuneyt Mertayak wrote:
>
> The content for the `render` method is supposed to be a dictionary: 
> https://docs.djangoproject.com/en/2.1/topics/http/shortcuts/#optional-arguments
>
> So change it to this render(requset, "FrounterWeb/body.html",{'tank': 
> tank})
>
> Also in the template file you want to display the properties of the ORM 
> (tank_system) object I guess, change them to {{tank.EC}}, 
> {{tank. temp}}, respectively.
>
> Hope it helps!
>

Thx for help
Cuneyt Mertayak

 but it didn't work, appreciate the reply, but suspect that the whiten the 
request to return there nothing, is the whole code become empty, that my 
believes 
 

-- 
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/45d9f4af-4807-4692-8d6e-dcc7ab14818a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Why I can't pass anything to my html? Django 2.1

2018-11-12 Thread Rookies DJ
I been trying 2 weeks on trying to pass variables form Django views into 
html, but every time I run my code, it works but it doesn't display the 
variable I see 

from django.shortcuts import render
from zigview.models import tank_system

def index(request):
return render(request,'FrounterWeb/includes.html')

def login(requset):
return render(requset, 'FrounterWeb/login.html')


def timedex(requset):
tank = tank_system.object.get(id(5))
print(tank)
return render(requset, "FrounterWeb/body.html",tank)


Here my models

from django.db import models


class user(models.Model):
username = models.CharField(max_length=50)
password = models.CharField(max_length=50)


class tank_system(models.Model):
Ph = models.DecimalField(max_digits=2, decimal_places=1)
EC = models.DecimalField(max_digits=2, decimal_places=1)
temp = models.DecimalField(max_digits=2, decimal_places=0)
level = models.IntegerField(primary_key=True, default=0)
data = models.DateTimeField(auto_now=True)


Here my HTML that i try pass variable in 



  Time
  Tank level
  EC
  pH
  room temptures
  Water temptrure


  22.30
  900 lits
  {{tank}}
  7.3
  {{tank}}
  24





My HTML body structures

Web

├── templates
│   ├── index.hmtl
│   │   └── includes
│   ├── body.hml
│   ├── header.html

  This my urls files;

from django.contrib import admin
from django.urls import include, path
from django.views.generic.base import TemplateView

urlpatterns = [
path(r'^admin/$', admin.site.urls),
path('account', include('django.contrib.auth.urls')),
path('', include('zigview.urls')),
path(r'', TemplateView.as_view(template_name='index.html'), name = 'myapp'),
]

-- 
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/8123c3d9-e972-426f-9b1f-46a463b98548%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.