Django bugfix release: 3.0.6.

2020-05-03 Thread Mariusz Felisiak

Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2020/may/04/django-bugfix-release-306/

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8e74e747-aa3f-6fa8-537e-774c8884a7dd%40gmail.com.


Re: Possible server attacks

2020-05-03 Thread Motaz Hejaze
check the log file , what are the acts that invokes the call to those links

example , logging in ? upload an image ? any act

also try to check if there is a malicious script installed on your server ,

take a peace from the text above and search for it ..

Example:

grep -lR "/sqlitemanager/main.php" /home

replace /home with the location of your files ..and replace the string by
anything from the error message above

On Mon, May 4, 2020 at 1:24 AM Ahmed Ishtiaque 
wrote:

> Observe how your server responds to these requests. Sometimes these
> requests are sent by attackers hoping that your server might respond with
> sensitive data that it shouldn't be sending. Generally, ensuring that
> invalid requests end up with your server sending error responses and not
> actual sensitive data that your database has is all you need to do.
>
> Hope this helps.
>
> On Sun, May 3, 2020 at 6:51 PM Miracle  wrote:
>
>> I do not know of any script like that.
>> Atleast, I didn't write any.
>>
>> A get these calls on the following paths:
>>
>> /sqlite/main.php,
>> /robots.txt,
>> /,
>> /owa/auth/logon.aspx,
>> /cgi-bin/config.exp,
>> /HNAP1/,
>> /hudson/script,
>> /script,
>> /sqlitemanager/main.php,
>>  /SQLiteManager/main.php,
>> /SQLite/main.php,
>> /main.php,
>> /test/sqlite/SQLiteManager-1.2.0/SQLiteManager-1.2.0/main.php,
>> /favicon.co
>>
>>
>> Please, what could be the problem?
>>
>>
>>
>>
>>
>> On Sun, 3 May 2020, 11:03 pm Motaz Hejaze,  wrote:
>>
>>> I think you have a script somewhere that calls this ip and main.php on
>>> that server ..
>>>
>>> Do you add any third party addons both on frontend and backend ??
>>>
>>>
>>> On Sun, 3 May 2020, 11:31 pm Miracle,  wrote:
>>>
 I think the possible attacker thinks I am using PHP

 On Sun, 3 May 2020, 10:29 pm Miracle,  wrote:

> I don't know honestly.
>
> I got those error messages because I included my email and username in
> settings.py like this
>
> ADMINS = ['username', 'collinsale...@gmail.com']
>
> On Sun, 3 May 2020, 10:24 pm Motaz Hejaze, 
> wrote:
>
>> What is the script main.php ???
>>
>> On Sun, 3 May 2020, 10:43 pm Miracle, 
>> wrote:
>>
>>> Hello django developers,
>>>
>>> I might be experiencing a possible attack on my web server,  but I
>>> am not sure yet.
>>> Below is the email I got from my django.
>>> I've gotten over 50 similar emails over the past 3 days.
>>>
>>> Please, help me with this.
>>>
>>>
>>> Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
>>> '35.192.28.182' to ALLOWED_HOSTS.
>>>
>>> Report at /SQlite/main.php
>>>
>>> Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
>>> '35.192.28.182' to ALLOWED_HOSTS.
>>>
>>> Request Method: GET
>>> Request URL: https://35.192.28.182/SQlite/main.php
>>>
>>> Django Version: 2.2.8
>>> Python Executable: /home/hello/wsp/env/bin/python3
>>> Python Version: 3.6.9
>>> Python Path: ['/home/hello/wsp', '/home/hello/wsp/env/bin',
>>> '/usr/lib/python36.zip', '/usr/lib/python3.6',
>>> '/usr/lib/python3.6/lib-dynload',
>>> '/home/hello/wsp/env/lib/python3.6/site-packages']
>>> Server time: Sun, 3 May 2020 19:22:55 +
>>> Show quoted text
>>> HTTP_ACCEPT =
>>> 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
>>> HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
>>> HTTP_ACCEPT_LANGUAGE = 'en-GB,en-US;q=0.9,en;q=0.8,ig;q=0.7'
>>> HTTP_CONNECTION = 'close'
>>> HTTP_COOKIE =
>>> 'csrftoken=mX6nNccvMIycyGeE4tF0hciqwfsccdaK8X8ZDt8YgimJeQYTjQFjxfB4YGNCZ9Ik;
>>> sessionid=mbmg0dvoz2tebman7ereia9eue59wto7'
>>> HTTP_HOST = '35.192.28.182'
>>> HTTP_SAVE_DATA = 'on'
>>>
>>> HTTP_SEC_FETCH_DEST = 'document'
>>> HTTP_SEC_FETCH_MODE = 'navigate'
>>> HTTP_SEC_FETCH_SITE = 'none'
>>> HTTP_UPGRADE_INSECURE_REQUESTS = '1'
>>> HTTP_USER_AGENT = 'Mozilla/5.0 (Linux; Android 9; SM-A307FN)
>>> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.117 Mobile
>>> Safari/537.36'
>>> HTTP_X_FORWARDED_FOR = '197.211.61.210'
>>> HTTP_X_FORWARDED_PROTO = 'https'
>>> HTTP_X_REAL_IP = '197.211.61.210'
>>> PATH_INFO = '/SQlite/main.php'
>>> QUERY_STRING = ''
>>> RAW_URI = '/SQlite/main.php'
>>> REMOTE_ADDR = ''
>>> REQUEST_METHOD = 'GET'
>>> SCRIPT_NAME = ''
>>> SERVER_NAME = '35.192.28.182'
>>> SERVER_PORT = '443'
>>> SERVER_PROTOCOL = 'HTTP/1.0'
>>> SERVER_SOFTWARE = 'gunicorn/20.0.4'
>>> gunicorn.socket = >> type=SocketKind.SOCK_STREAM, proto=0, laddr=/home/hello/wsp/app.sock>
>>> wsgi.errors = >> 0x7f20fa4288d0>
>>> wsgi.file_wrapper = ''
>>> wsgi.input = 
>>>
>>>
>>>
>>>
>>> kind  regards*,*
>>>
>>> Miracle.
>>>
>>> --
>>> You received this message 

Re: Possible server attacks

2020-05-03 Thread Ahmed Ishtiaque
Observe how your server responds to these requests. Sometimes these
requests are sent by attackers hoping that your server might respond with
sensitive data that it shouldn't be sending. Generally, ensuring that
invalid requests end up with your server sending error responses and not
actual sensitive data that your database has is all you need to do.

Hope this helps.

On Sun, May 3, 2020 at 6:51 PM Miracle  wrote:

> I do not know of any script like that.
> Atleast, I didn't write any.
>
> A get these calls on the following paths:
>
> /sqlite/main.php,
> /robots.txt,
> /,
> /owa/auth/logon.aspx,
> /cgi-bin/config.exp,
> /HNAP1/,
> /hudson/script,
> /script,
> /sqlitemanager/main.php,
>  /SQLiteManager/main.php,
> /SQLite/main.php,
> /main.php,
> /test/sqlite/SQLiteManager-1.2.0/SQLiteManager-1.2.0/main.php,
> /favicon.co
>
>
> Please, what could be the problem?
>
>
>
>
>
> On Sun, 3 May 2020, 11:03 pm Motaz Hejaze,  wrote:
>
>> I think you have a script somewhere that calls this ip and main.php on
>> that server ..
>>
>> Do you add any third party addons both on frontend and backend ??
>>
>>
>> On Sun, 3 May 2020, 11:31 pm Miracle,  wrote:
>>
>>> I think the possible attacker thinks I am using PHP
>>>
>>> On Sun, 3 May 2020, 10:29 pm Miracle,  wrote:
>>>
 I don't know honestly.

 I got those error messages because I included my email and username in
 settings.py like this

 ADMINS = ['username', 'collinsale...@gmail.com']

 On Sun, 3 May 2020, 10:24 pm Motaz Hejaze, 
 wrote:

> What is the script main.php ???
>
> On Sun, 3 May 2020, 10:43 pm Miracle,  wrote:
>
>> Hello django developers,
>>
>> I might be experiencing a possible attack on my web server,  but I am
>> not sure yet.
>> Below is the email I got from my django.
>> I've gotten over 50 similar emails over the past 3 days.
>>
>> Please, help me with this.
>>
>>
>> Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
>> '35.192.28.182' to ALLOWED_HOSTS.
>>
>> Report at /SQlite/main.php
>>
>> Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
>> '35.192.28.182' to ALLOWED_HOSTS.
>>
>> Request Method: GET
>> Request URL: https://35.192.28.182/SQlite/main.php
>>
>> Django Version: 2.2.8
>> Python Executable: /home/hello/wsp/env/bin/python3
>> Python Version: 3.6.9
>> Python Path: ['/home/hello/wsp', '/home/hello/wsp/env/bin',
>> '/usr/lib/python36.zip', '/usr/lib/python3.6',
>> '/usr/lib/python3.6/lib-dynload',
>> '/home/hello/wsp/env/lib/python3.6/site-packages']
>> Server time: Sun, 3 May 2020 19:22:55 +
>> Show quoted text
>> HTTP_ACCEPT =
>> 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
>> HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
>> HTTP_ACCEPT_LANGUAGE = 'en-GB,en-US;q=0.9,en;q=0.8,ig;q=0.7'
>> HTTP_CONNECTION = 'close'
>> HTTP_COOKIE =
>> 'csrftoken=mX6nNccvMIycyGeE4tF0hciqwfsccdaK8X8ZDt8YgimJeQYTjQFjxfB4YGNCZ9Ik;
>> sessionid=mbmg0dvoz2tebman7ereia9eue59wto7'
>> HTTP_HOST = '35.192.28.182'
>> HTTP_SAVE_DATA = 'on'
>>
>> HTTP_SEC_FETCH_DEST = 'document'
>> HTTP_SEC_FETCH_MODE = 'navigate'
>> HTTP_SEC_FETCH_SITE = 'none'
>> HTTP_UPGRADE_INSECURE_REQUESTS = '1'
>> HTTP_USER_AGENT = 'Mozilla/5.0 (Linux; Android 9; SM-A307FN)
>> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.117 Mobile
>> Safari/537.36'
>> HTTP_X_FORWARDED_FOR = '197.211.61.210'
>> HTTP_X_FORWARDED_PROTO = 'https'
>> HTTP_X_REAL_IP = '197.211.61.210'
>> PATH_INFO = '/SQlite/main.php'
>> QUERY_STRING = ''
>> RAW_URI = '/SQlite/main.php'
>> REMOTE_ADDR = ''
>> REQUEST_METHOD = 'GET'
>> SCRIPT_NAME = ''
>> SERVER_NAME = '35.192.28.182'
>> SERVER_PORT = '443'
>> SERVER_PROTOCOL = 'HTTP/1.0'
>> SERVER_SOFTWARE = 'gunicorn/20.0.4'
>> gunicorn.socket = > type=SocketKind.SOCK_STREAM, proto=0, laddr=/home/hello/wsp/app.sock>
>> wsgi.errors = > 0x7f20fa4288d0>
>> wsgi.file_wrapper = ''
>> wsgi.input = 
>>
>>
>>
>>
>> kind  regards*,*
>>
>> Miracle.
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CADZv-jBZojn_UhiYUgPZiP2tvcYnmggOVq24nUbCXCX_D0990A%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google

Re: Possible server attacks

2020-05-03 Thread Miracle
I do not know of any script like that.
Atleast, I didn't write any.

A get these calls on the following paths:

/sqlite/main.php,
/robots.txt,
/,
/owa/auth/logon.aspx,
/cgi-bin/config.exp,
/HNAP1/,
/hudson/script,
/script,
/sqlitemanager/main.php,
 /SQLiteManager/main.php,
/SQLite/main.php,
/main.php,
/test/sqlite/SQLiteManager-1.2.0/SQLiteManager-1.2.0/main.php,
/favicon.co


Please, what could be the problem?





On Sun, 3 May 2020, 11:03 pm Motaz Hejaze,  wrote:

> I think you have a script somewhere that calls this ip and main.php on
> that server ..
>
> Do you add any third party addons both on frontend and backend ??
>
>
> On Sun, 3 May 2020, 11:31 pm Miracle,  wrote:
>
>> I think the possible attacker thinks I am using PHP
>>
>> On Sun, 3 May 2020, 10:29 pm Miracle,  wrote:
>>
>>> I don't know honestly.
>>>
>>> I got those error messages because I included my email and username in
>>> settings.py like this
>>>
>>> ADMINS = ['username', 'collinsale...@gmail.com']
>>>
>>> On Sun, 3 May 2020, 10:24 pm Motaz Hejaze,  wrote:
>>>
 What is the script main.php ???

 On Sun, 3 May 2020, 10:43 pm Miracle,  wrote:

> Hello django developers,
>
> I might be experiencing a possible attack on my web server,  but I am
> not sure yet.
> Below is the email I got from my django.
> I've gotten over 50 similar emails over the past 3 days.
>
> Please, help me with this.
>
>
> Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
> '35.192.28.182' to ALLOWED_HOSTS.
>
> Report at /SQlite/main.php
>
> Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
> '35.192.28.182' to ALLOWED_HOSTS.
>
> Request Method: GET
> Request URL: https://35.192.28.182/SQlite/main.php
>
> Django Version: 2.2.8
> Python Executable: /home/hello/wsp/env/bin/python3
> Python Version: 3.6.9
> Python Path: ['/home/hello/wsp', '/home/hello/wsp/env/bin',
> '/usr/lib/python36.zip', '/usr/lib/python3.6',
> '/usr/lib/python3.6/lib-dynload',
> '/home/hello/wsp/env/lib/python3.6/site-packages']
> Server time: Sun, 3 May 2020 19:22:55 +
> Show quoted text
> HTTP_ACCEPT =
> 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
> HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
> HTTP_ACCEPT_LANGUAGE = 'en-GB,en-US;q=0.9,en;q=0.8,ig;q=0.7'
> HTTP_CONNECTION = 'close'
> HTTP_COOKIE =
> 'csrftoken=mX6nNccvMIycyGeE4tF0hciqwfsccdaK8X8ZDt8YgimJeQYTjQFjxfB4YGNCZ9Ik;
> sessionid=mbmg0dvoz2tebman7ereia9eue59wto7'
> HTTP_HOST = '35.192.28.182'
> HTTP_SAVE_DATA = 'on'
>
> HTTP_SEC_FETCH_DEST = 'document'
> HTTP_SEC_FETCH_MODE = 'navigate'
> HTTP_SEC_FETCH_SITE = 'none'
> HTTP_UPGRADE_INSECURE_REQUESTS = '1'
> HTTP_USER_AGENT = 'Mozilla/5.0 (Linux; Android 9; SM-A307FN)
> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.117 Mobile
> Safari/537.36'
> HTTP_X_FORWARDED_FOR = '197.211.61.210'
> HTTP_X_FORWARDED_PROTO = 'https'
> HTTP_X_REAL_IP = '197.211.61.210'
> PATH_INFO = '/SQlite/main.php'
> QUERY_STRING = ''
> RAW_URI = '/SQlite/main.php'
> REMOTE_ADDR = ''
> REQUEST_METHOD = 'GET'
> SCRIPT_NAME = ''
> SERVER_NAME = '35.192.28.182'
> SERVER_PORT = '443'
> SERVER_PROTOCOL = 'HTTP/1.0'
> SERVER_SOFTWARE = 'gunicorn/20.0.4'
> gunicorn.socket =  type=SocketKind.SOCK_STREAM, proto=0, laddr=/home/hello/wsp/app.sock>
> wsgi.errors =  0x7f20fa4288d0>
> wsgi.file_wrapper = ''
> wsgi.input = 
>
>
>
>
> kind  regards*,*
>
> Miracle.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CADZv-jBZojn_UhiYUgPZiP2tvcYnmggOVq24nUbCXCX_D0990A%40mail.gmail.com
> 
> .
>
 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAHV4E-d0iU5tYOPBeAVTuQLUgzVOM4v9Gu4s_rtxLqFFZr71dA%40mail.gmail.com
 
 .

>>> --
>> You received this message because you are subscribed to the Google Groups

Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-03 Thread Motaz Hejaze
please share your models.py file

On Mon, May 4, 2020 at 12:13 AM Adedotun Richard 
wrote:

> Can you paste your model.py class for products?
> There is probability that you are getting the write-up wrong.
>
>
> On Sat, May 2, 2020, 3:43 PM Iain Stewart 
> wrote:
>
>> Hi Folks,
>>
>> I am a learner and am enjoying learning Django so far (about a month
>> in). I am doing the Mosh Python Tutorial for Begnniners on You Tube and in
>> trying to save my first product on the Django admin/ products page and got
>> the following error. I suspect the problem is between Django and SQLite.
>> Any possible solution would be appreciated. Thanks!
>> Request Method: POST Request URL: 
>> http://127.0.0.1:8000/admin/products/product/add/
>>
>> 
>>  Django
>> Version: 2.1 Python Version: 3.7.7 Installed Applications: 
>> ['django.contrib.admin',
>> 'django.contrib.auth', 'django.contrib.contenttypes', 
>> 'django.contrib.sessions',
>> 'django.contrib.messages', 'django.contrib.staticfiles', 
>> 'products.apps.ProductsConfig']
>> Installed Middleware: ['django.middleware.security.SecurityMiddleware', 
>> 'django.contrib.sessions.middleware.SessionMiddleware',
>> 'django.middleware.common.CommonMiddleware', 
>> 'django.middleware.csrf.CsrfViewMiddleware',
>> 'django.contrib.auth.middleware.AuthenticationMiddleware', 
>> 'django.contrib.messages.middleware.MessageMiddleware',
>> 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback: File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\
>> utils.py
>> "
>> in _execute 85. return self.cursor.execute(sql, params) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\
>> base.py
>> "
>> in execute 296. return Database.Cursor.execute(self, query, params) The
>> above exception (no such table: main.auth_user__old) was the direct cause
>> of the following exception: File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>> exception.py
>> "
>> in inner 34. response = get_response(request) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>> base.py
>> "
>> in _get_response 126. response = self.process_exception_by_middleware(e,
>> request) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>> base.py
>> "
>> in _get_response 124. response = wrapped_callback(request,
>> *callback_args, **callback_kwargs) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
>> options.py
>> "
>> in wrapper 607. return self.admin_site.admin_view(view)(*args, **kwargs) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\
>> decorators.py
>> "
>> in _wrapped_view 142. response = view_func(request, *args, **kwargs) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\views\decorators\
>> cache.py
>> "
>> in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
>> sites.py
>> "
>> in inner 223. return view(request, *args, **kwargs) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
>> options.py
>> 

Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-03 Thread Adedotun Richard
Can you paste your model.py class for products?
There is probability that you are getting the write-up wrong.


On Sat, May 2, 2020, 3:43 PM Iain Stewart  wrote:

> Hi Folks,
>
> I am a learner and am enjoying learning Django so far (about a month in).
> I am doing the Mosh Python Tutorial for Begnniners on You Tube and in
> trying to save my first product on the Django admin/ products page and got
> the following error. I suspect the problem is between Django and SQLite.
> Any possible solution would be appreciated. Thanks!
> Request Method: POST Request URL: 
> http://127.0.0.1:8000/admin/products/product/add/
>
> 
>  Django
> Version: 2.1 Python Version: 3.7.7 Installed Applications: 
> ['django.contrib.admin',
> 'django.contrib.auth', 'django.contrib.contenttypes', 
> 'django.contrib.sessions',
> 'django.contrib.messages', 'django.contrib.staticfiles', 
> 'products.apps.ProductsConfig']
> Installed Middleware: ['django.middleware.security.SecurityMiddleware', 
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware', 
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware', 
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback: File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\
> utils.py
> "
> in _execute 85. return self.cursor.execute(sql, params) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\
> base.py
> "
> in execute 296. return Database.Cursor.execute(self, query, params) The
> above exception (no such table: main.auth_user__old) was the direct cause
> of the following exception: File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
> exception.py
> "
> in inner 34. response = get_response(request) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
> base.py
> "
> in _get_response 126. response = self.process_exception_by_middleware(e,
> request) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
> base.py
> "
> in _get_response 124. response = wrapped_callback(request,
> *callback_args, **callback_kwargs) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
> options.py
> "
> in wrapper 607. return self.admin_site.admin_view(view)(*args, **kwargs) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\
> decorators.py
> "
> in _wrapped_view 142. response = view_func(request, *args, **kwargs) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\views\decorators\
> cache.py
> "
> in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
> sites.py
> "
> in inner 223. return view(request, *args, **kwargs) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
> options.py
> "
> in add_view 1647. return self.changeform_view(request, 

Re: Deploying Django Project on heroku

2020-05-03 Thread Motaz Hejaze
Let us have a zoom meeting to fix it

On Sun, 3 May 2020, 11:45 pm Sunday Iyanu Ajayi, 
wrote:

> I have but it keeps telling  that it is misconfigured
> *AJAYI Sunday *
> (+234) 806 771 5394
> *sunnexaj...@gmail.com *
>
>
>
> On Sat, Apr 25, 2020 at 3:17 PM sagar ninave 
> wrote:
>
>> Do you installed whitenoise package
>> If not then run this command
>> Pip insatll whitenoise
>>
>> On Sat, 25 Apr 2020 at 7:43 PM, Sunday Iyanu Ajayi 
>> wrote:
>>
>>> I have spent over 2weeks on deploying a django project to heroku but I
>>> keep getting error messages such as :
>>>
>>> My WhiteNoise is not configured  and I have followed all the tutorials
>>> recommended  and yet same thing.
>>>
>>> Please who has a guide I can follow that is very updated.
>>> Thank you.
>>> *AJAYI Sunday *
>>> (+234) 806 771 5394
>>> *sunnexaj...@gmail.com *
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAKYSAw2PsC452Sk5_1e_sMy3HuZ3zWrFh5p6CVn6K-KsVF1Rqg%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>>
>> 
>> sagar ninave
>> about.me/sagarninave
>> 
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAA6pdZ9fsGj3y%3DNVVQ_oCX9hY5DbLHtPVLM-nPhWYxpE4Qsi7w%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKYSAw2hYQGRYYZRB%3D7ZNJJJ-1OY2ykShsPam9xiRc-8M4BQJg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHV4E-dLr30ycFTo9tccTmKW74rvDA%3D0Oks8NqAVez0Tiyzocg%40mail.gmail.com.


Re: Possible server attacks

2020-05-03 Thread Motaz Hejaze
I think you have a script somewhere that calls this ip and main.php on
that server ..

Do you add any third party addons both on frontend and backend ??


On Sun, 3 May 2020, 11:31 pm Miracle,  wrote:

> I think the possible attacker thinks I am using PHP
>
> On Sun, 3 May 2020, 10:29 pm Miracle,  wrote:
>
>> I don't know honestly.
>>
>> I got those error messages because I included my email and username in
>> settings.py like this
>>
>> ADMINS = ['username', 'collinsale...@gmail.com']
>>
>> On Sun, 3 May 2020, 10:24 pm Motaz Hejaze,  wrote:
>>
>>> What is the script main.php ???
>>>
>>> On Sun, 3 May 2020, 10:43 pm Miracle,  wrote:
>>>
 Hello django developers,

 I might be experiencing a possible attack on my web server,  but I am
 not sure yet.
 Below is the email I got from my django.
 I've gotten over 50 similar emails over the past 3 days.

 Please, help me with this.


 Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
 '35.192.28.182' to ALLOWED_HOSTS.

 Report at /SQlite/main.php

 Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
 '35.192.28.182' to ALLOWED_HOSTS.

 Request Method: GET
 Request URL: https://35.192.28.182/SQlite/main.php

 Django Version: 2.2.8
 Python Executable: /home/hello/wsp/env/bin/python3
 Python Version: 3.6.9
 Python Path: ['/home/hello/wsp', '/home/hello/wsp/env/bin',
 '/usr/lib/python36.zip', '/usr/lib/python3.6',
 '/usr/lib/python3.6/lib-dynload',
 '/home/hello/wsp/env/lib/python3.6/site-packages']
 Server time: Sun, 3 May 2020 19:22:55 +
 Show quoted text
 HTTP_ACCEPT =
 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
 HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
 HTTP_ACCEPT_LANGUAGE = 'en-GB,en-US;q=0.9,en;q=0.8,ig;q=0.7'
 HTTP_CONNECTION = 'close'
 HTTP_COOKIE =
 'csrftoken=mX6nNccvMIycyGeE4tF0hciqwfsccdaK8X8ZDt8YgimJeQYTjQFjxfB4YGNCZ9Ik;
 sessionid=mbmg0dvoz2tebman7ereia9eue59wto7'
 HTTP_HOST = '35.192.28.182'
 HTTP_SAVE_DATA = 'on'

 HTTP_SEC_FETCH_DEST = 'document'
 HTTP_SEC_FETCH_MODE = 'navigate'
 HTTP_SEC_FETCH_SITE = 'none'
 HTTP_UPGRADE_INSECURE_REQUESTS = '1'
 HTTP_USER_AGENT = 'Mozilla/5.0 (Linux; Android 9; SM-A307FN)
 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.117 Mobile
 Safari/537.36'
 HTTP_X_FORWARDED_FOR = '197.211.61.210'
 HTTP_X_FORWARDED_PROTO = 'https'
 HTTP_X_REAL_IP = '197.211.61.210'
 PATH_INFO = '/SQlite/main.php'
 QUERY_STRING = ''
 RAW_URI = '/SQlite/main.php'
 REMOTE_ADDR = ''
 REQUEST_METHOD = 'GET'
 SCRIPT_NAME = ''
 SERVER_NAME = '35.192.28.182'
 SERVER_PORT = '443'
 SERVER_PROTOCOL = 'HTTP/1.0'
 SERVER_SOFTWARE = 'gunicorn/20.0.4'
 gunicorn.socket = >>> type=SocketKind.SOCK_STREAM, proto=0, laddr=/home/hello/wsp/app.sock>
 wsgi.errors = >>> 0x7f20fa4288d0>
 wsgi.file_wrapper = ''
 wsgi.input = 




 kind  regards*,*

 Miracle.

 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CADZv-jBZojn_UhiYUgPZiP2tvcYnmggOVq24nUbCXCX_D0990A%40mail.gmail.com
 
 .

>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAHV4E-d0iU5tYOPBeAVTuQLUgzVOM4v9Gu4s_rtxLqFFZr71dA%40mail.gmail.com
>>> 
>>> .
>>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CADZv-jDTCNZMFy_6gp4X_cx5Vy9vMCWEk_X-GKsYizeTpWEkow%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this 

Re: Deploying Django Project on heroku

2020-05-03 Thread Sunday Iyanu Ajayi
I have but it keeps telling  that it is misconfigured
*AJAYI Sunday *
(+234) 806 771 5394
*sunnexaj...@gmail.com *



On Sat, Apr 25, 2020 at 3:17 PM sagar ninave  wrote:

> Do you installed whitenoise package
> If not then run this command
> Pip insatll whitenoise
>
> On Sat, 25 Apr 2020 at 7:43 PM, Sunday Iyanu Ajayi 
> wrote:
>
>> I have spent over 2weeks on deploying a django project to heroku but I
>> keep getting error messages such as :
>>
>> My WhiteNoise is not configured  and I have followed all the tutorials
>> recommended  and yet same thing.
>>
>> Please who has a guide I can follow that is very updated.
>> Thank you.
>> *AJAYI Sunday *
>> (+234) 806 771 5394
>> *sunnexaj...@gmail.com *
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAKYSAw2PsC452Sk5_1e_sMy3HuZ3zWrFh5p6CVn6K-KsVF1Rqg%40mail.gmail.com
>> 
>> .
>>
> --
>
> 
> sagar ninave
> about.me/sagarninave
> 
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAA6pdZ9fsGj3y%3DNVVQ_oCX9hY5DbLHtPVLM-nPhWYxpE4Qsi7w%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKYSAw2hYQGRYYZRB%3D7ZNJJJ-1OY2ykShsPam9xiRc-8M4BQJg%40mail.gmail.com.


Re: Notifications in DRF

2020-05-03 Thread Sunday Iyanu Ajayi
I have and it is pretty straight forward.
Check his demo:https://github.com/xtrinch/fcm-django-web-demo
*AJAYI Sunday *
(+234) 806 771 5394
*sunnexaj...@gmail.com *



On Tue, Apr 21, 2020 at 1:02 PM shreehari Vaasistha L <
shreehari9...@gmail.com> wrote:

> if anyone has implemented FCM in django rest framework using
> https://github.com/xtrinch/fcm-django or anyother packages, please share
> it with me.
> need to send notifications to devices.
> Thanks in Advance !
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/08cda12c-51d4-4dc2-8448-9f18dd6b3c9b%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKYSAw2Ff-tcGPgmBc0hrP9_ncHA3mG3SW7b87A5OoHhEmHRrQ%40mail.gmail.com.


Re: Need help whit DJANGO_SETTINGS_MODULE

2020-05-03 Thread Sunday Iyanu Ajayi
Hi Ilie Ioana,
Please check if
1. You are in your current directory ( or virtual evironment)
2. Is django installed on yur pc?

*AJAYI Sunday *
(+234) 806 771 5394
*sunnexaj...@gmail.com *



On Sun, Apr 19, 2020 at 2:22 PM Ilie Ioana  wrote:

> Hi,I'm new with django and python.
> I just strated a new django project in a venv using django 3.0 and seems
> that DJANGO_SETTINGS_MODULE is not set when running django-admin runserver
>
> Enter code here.(test1) 
> ioana.i@ioana-spamexperts:~/Workspace/Ioana/test1/test1$
>> django-admin runserver
>> Traceback (most recent call last):
>>   File "/home/ioana.i/Workspace/Ioana/test1/bin/django-admin", line 8, in
>> 
>> sys.exit(execute_from_command_line())
>>   File
>> "/home/ioana.i/Workspace/Ioana/test1/lib/python3.6/site-packages/django/core/management/__init__.py",
>> line 401, in execute_from_command_line
>> utility.execute()
>>   File
>> "/home/ioana.i/Workspace/Ioana/test1/lib/python3.6/site-packages/django/core/management/__init__.py",
>> line 395, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File
>> "/home/ioana.i/Workspace/Ioana/test1/lib/python3.6/site-packages/django/core/management/base.py",
>> line 328, in run_from_argv
>> self.execute(*args, **cmd_options)
>>   File
>> "/home/ioana.i/Workspace/Ioana/test1/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
>> line 60, in execute
>> super().execute(*args, **options)
>>   File
>> "/home/ioana.i/Workspace/Ioana/test1/lib/python3.6/site-packages/django/core/management/base.py",
>> line 369, in execute
>> output = self.handle(*args, **options)
>>   File
>> "/home/ioana.i/Workspace/Ioana/test1/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
>> line 67, in handle
>> if not settings.DEBUG and not settings.ALLOWED_HOSTS:
>>   File
>> "/home/ioana.i/Workspace/Ioana/test1/lib/python3.6/site-packages/django/conf/__init__.py",
>> line 76, in __getattr__
>> self._setup(name)
>>   File
>> "/home/ioana.i/Workspace/Ioana/test1/lib/python3.6/site-packages/django/conf/__init__.py",
>> line 61, in _setup
>> % (desc, ENVIRONMENT_VARIABLE))
>> django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but
>> settings are not configured. You must either define the environment
>> variable DJANGO_SETTINGS_MODULE or call settings.configure() before
>> accessing settings.
>> ..
>>
>>
>>
> I tried to set it myself with export DJANGO_SETTINGS_MODULE=test1.settings
> but i receive  ModuleNotFoundError: No module named 'test1'
> Seems like test1 module is not in the path, shouldn't be automatically
> added there?
>
> (test1) ioana.i@ioana-spamexperts:~/Workspace/Ioana/test1/test1$
> django-admin shell
> Python 3.6.9 (default, Nov  7 2019, 10:44:02)
> [GCC 8.3.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>> import sys
> >>> sys.path
> ['/home/ioana.i/Workspace/Ioana/test1/bin', '/usr/lib/python36.zip',
> '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload',
> '/home/ioana.i/Workspace/Ioana/test1/lib/python3.6/site-packages']
> >>>
>
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/07386bda-38a4-4897-b428-c8a39e52c487%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKYSAw1XvpP4om4XJ-vbNqikum2b9soEcSre3rxAcMwGxqcy7w%40mail.gmail.com.


Re: Possible server attacks

2020-05-03 Thread Miracle
I think the possible attacker thinks I am using PHP

On Sun, 3 May 2020, 10:29 pm Miracle,  wrote:

> I don't know honestly.
>
> I got those error messages because I included my email and username in
> settings.py like this
>
> ADMINS = ['username', 'collinsale...@gmail.com']
>
> On Sun, 3 May 2020, 10:24 pm Motaz Hejaze,  wrote:
>
>> What is the script main.php ???
>>
>> On Sun, 3 May 2020, 10:43 pm Miracle,  wrote:
>>
>>> Hello django developers,
>>>
>>> I might be experiencing a possible attack on my web server,  but I am
>>> not sure yet.
>>> Below is the email I got from my django.
>>> I've gotten over 50 similar emails over the past 3 days.
>>>
>>> Please, help me with this.
>>>
>>>
>>> Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
>>> '35.192.28.182' to ALLOWED_HOSTS.
>>>
>>> Report at /SQlite/main.php
>>>
>>> Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
>>> '35.192.28.182' to ALLOWED_HOSTS.
>>>
>>> Request Method: GET
>>> Request URL: https://35.192.28.182/SQlite/main.php
>>>
>>> Django Version: 2.2.8
>>> Python Executable: /home/hello/wsp/env/bin/python3
>>> Python Version: 3.6.9
>>> Python Path: ['/home/hello/wsp', '/home/hello/wsp/env/bin',
>>> '/usr/lib/python36.zip', '/usr/lib/python3.6',
>>> '/usr/lib/python3.6/lib-dynload',
>>> '/home/hello/wsp/env/lib/python3.6/site-packages']
>>> Server time: Sun, 3 May 2020 19:22:55 +
>>> Show quoted text
>>> HTTP_ACCEPT =
>>> 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
>>> HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
>>> HTTP_ACCEPT_LANGUAGE = 'en-GB,en-US;q=0.9,en;q=0.8,ig;q=0.7'
>>> HTTP_CONNECTION = 'close'
>>> HTTP_COOKIE =
>>> 'csrftoken=mX6nNccvMIycyGeE4tF0hciqwfsccdaK8X8ZDt8YgimJeQYTjQFjxfB4YGNCZ9Ik;
>>> sessionid=mbmg0dvoz2tebman7ereia9eue59wto7'
>>> HTTP_HOST = '35.192.28.182'
>>> HTTP_SAVE_DATA = 'on'
>>>
>>> HTTP_SEC_FETCH_DEST = 'document'
>>> HTTP_SEC_FETCH_MODE = 'navigate'
>>> HTTP_SEC_FETCH_SITE = 'none'
>>> HTTP_UPGRADE_INSECURE_REQUESTS = '1'
>>> HTTP_USER_AGENT = 'Mozilla/5.0 (Linux; Android 9; SM-A307FN)
>>> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.117 Mobile
>>> Safari/537.36'
>>> HTTP_X_FORWARDED_FOR = '197.211.61.210'
>>> HTTP_X_FORWARDED_PROTO = 'https'
>>> HTTP_X_REAL_IP = '197.211.61.210'
>>> PATH_INFO = '/SQlite/main.php'
>>> QUERY_STRING = ''
>>> RAW_URI = '/SQlite/main.php'
>>> REMOTE_ADDR = ''
>>> REQUEST_METHOD = 'GET'
>>> SCRIPT_NAME = ''
>>> SERVER_NAME = '35.192.28.182'
>>> SERVER_PORT = '443'
>>> SERVER_PROTOCOL = 'HTTP/1.0'
>>> SERVER_SOFTWARE = 'gunicorn/20.0.4'
>>> gunicorn.socket = >> type=SocketKind.SOCK_STREAM, proto=0, laddr=/home/hello/wsp/app.sock>
>>> wsgi.errors = >> 0x7f20fa4288d0>
>>> wsgi.file_wrapper = ''
>>> wsgi.input = 
>>>
>>>
>>>
>>>
>>> kind  regards*,*
>>>
>>> Miracle.
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CADZv-jBZojn_UhiYUgPZiP2tvcYnmggOVq24nUbCXCX_D0990A%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAHV4E-d0iU5tYOPBeAVTuQLUgzVOM4v9Gu4s_rtxLqFFZr71dA%40mail.gmail.com
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADZv-jDTCNZMFy_6gp4X_cx5Vy9vMCWEk_X-GKsYizeTpWEkow%40mail.gmail.com.


Re: Possible server attacks

2020-05-03 Thread Miracle
I don't know honestly.

I got those error messages because I included my email and username in
settings.py like this

ADMINS = ['username', 'collinsale...@gmail.com']

On Sun, 3 May 2020, 10:24 pm Motaz Hejaze,  wrote:

> What is the script main.php ???
>
> On Sun, 3 May 2020, 10:43 pm Miracle,  wrote:
>
>> Hello django developers,
>>
>> I might be experiencing a possible attack on my web server,  but I am not
>> sure yet.
>> Below is the email I got from my django.
>> I've gotten over 50 similar emails over the past 3 days.
>>
>> Please, help me with this.
>>
>>
>> Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
>> '35.192.28.182' to ALLOWED_HOSTS.
>>
>> Report at /SQlite/main.php
>>
>> Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
>> '35.192.28.182' to ALLOWED_HOSTS.
>>
>> Request Method: GET
>> Request URL: https://35.192.28.182/SQlite/main.php
>>
>> Django Version: 2.2.8
>> Python Executable: /home/hello/wsp/env/bin/python3
>> Python Version: 3.6.9
>> Python Path: ['/home/hello/wsp', '/home/hello/wsp/env/bin',
>> '/usr/lib/python36.zip', '/usr/lib/python3.6',
>> '/usr/lib/python3.6/lib-dynload',
>> '/home/hello/wsp/env/lib/python3.6/site-packages']
>> Server time: Sun, 3 May 2020 19:22:55 +
>> Show quoted text
>> HTTP_ACCEPT =
>> 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
>> HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
>> HTTP_ACCEPT_LANGUAGE = 'en-GB,en-US;q=0.9,en;q=0.8,ig;q=0.7'
>> HTTP_CONNECTION = 'close'
>> HTTP_COOKIE =
>> 'csrftoken=mX6nNccvMIycyGeE4tF0hciqwfsccdaK8X8ZDt8YgimJeQYTjQFjxfB4YGNCZ9Ik;
>> sessionid=mbmg0dvoz2tebman7ereia9eue59wto7'
>> HTTP_HOST = '35.192.28.182'
>> HTTP_SAVE_DATA = 'on'
>>
>> HTTP_SEC_FETCH_DEST = 'document'
>> HTTP_SEC_FETCH_MODE = 'navigate'
>> HTTP_SEC_FETCH_SITE = 'none'
>> HTTP_UPGRADE_INSECURE_REQUESTS = '1'
>> HTTP_USER_AGENT = 'Mozilla/5.0 (Linux; Android 9; SM-A307FN)
>> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.117 Mobile
>> Safari/537.36'
>> HTTP_X_FORWARDED_FOR = '197.211.61.210'
>> HTTP_X_FORWARDED_PROTO = 'https'
>> HTTP_X_REAL_IP = '197.211.61.210'
>> PATH_INFO = '/SQlite/main.php'
>> QUERY_STRING = ''
>> RAW_URI = '/SQlite/main.php'
>> REMOTE_ADDR = ''
>> REQUEST_METHOD = 'GET'
>> SCRIPT_NAME = ''
>> SERVER_NAME = '35.192.28.182'
>> SERVER_PORT = '443'
>> SERVER_PROTOCOL = 'HTTP/1.0'
>> SERVER_SOFTWARE = 'gunicorn/20.0.4'
>> gunicorn.socket = > type=SocketKind.SOCK_STREAM, proto=0, laddr=/home/hello/wsp/app.sock>
>> wsgi.errors = > 0x7f20fa4288d0>
>> wsgi.file_wrapper = ''
>> wsgi.input = 
>>
>>
>>
>>
>> kind  regards*,*
>>
>> Miracle.
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CADZv-jBZojn_UhiYUgPZiP2tvcYnmggOVq24nUbCXCX_D0990A%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHV4E-d0iU5tYOPBeAVTuQLUgzVOM4v9Gu4s_rtxLqFFZr71dA%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADZv-jD%3DmcgZf7qgOwoWyrS67p-FMUrCfxY1q7T%3D3exPK0Wn8A%40mail.gmail.com.


Re: Possible server attacks

2020-05-03 Thread Motaz Hejaze
What is the script main.php ???

On Sun, 3 May 2020, 10:43 pm Miracle,  wrote:

> Hello django developers,
>
> I might be experiencing a possible attack on my web server,  but I am not
> sure yet.
> Below is the email I got from my django.
> I've gotten over 50 similar emails over the past 3 days.
>
> Please, help me with this.
>
>
> Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
> '35.192.28.182' to ALLOWED_HOSTS.
>
> Report at /SQlite/main.php
>
> Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
> '35.192.28.182' to ALLOWED_HOSTS.
>
> Request Method: GET
> Request URL: https://35.192.28.182/SQlite/main.php
>
> Django Version: 2.2.8
> Python Executable: /home/hello/wsp/env/bin/python3
> Python Version: 3.6.9
> Python Path: ['/home/hello/wsp', '/home/hello/wsp/env/bin',
> '/usr/lib/python36.zip', '/usr/lib/python3.6',
> '/usr/lib/python3.6/lib-dynload',
> '/home/hello/wsp/env/lib/python3.6/site-packages']
> Server time: Sun, 3 May 2020 19:22:55 +
> Show quoted text
> HTTP_ACCEPT =
> 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
> HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
> HTTP_ACCEPT_LANGUAGE = 'en-GB,en-US;q=0.9,en;q=0.8,ig;q=0.7'
> HTTP_CONNECTION = 'close'
> HTTP_COOKIE =
> 'csrftoken=mX6nNccvMIycyGeE4tF0hciqwfsccdaK8X8ZDt8YgimJeQYTjQFjxfB4YGNCZ9Ik;
> sessionid=mbmg0dvoz2tebman7ereia9eue59wto7'
> HTTP_HOST = '35.192.28.182'
> HTTP_SAVE_DATA = 'on'
>
> HTTP_SEC_FETCH_DEST = 'document'
> HTTP_SEC_FETCH_MODE = 'navigate'
> HTTP_SEC_FETCH_SITE = 'none'
> HTTP_UPGRADE_INSECURE_REQUESTS = '1'
> HTTP_USER_AGENT = 'Mozilla/5.0 (Linux; Android 9; SM-A307FN)
> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.117 Mobile
> Safari/537.36'
> HTTP_X_FORWARDED_FOR = '197.211.61.210'
> HTTP_X_FORWARDED_PROTO = 'https'
> HTTP_X_REAL_IP = '197.211.61.210'
> PATH_INFO = '/SQlite/main.php'
> QUERY_STRING = ''
> RAW_URI = '/SQlite/main.php'
> REMOTE_ADDR = ''
> REQUEST_METHOD = 'GET'
> SCRIPT_NAME = ''
> SERVER_NAME = '35.192.28.182'
> SERVER_PORT = '443'
> SERVER_PROTOCOL = 'HTTP/1.0'
> SERVER_SOFTWARE = 'gunicorn/20.0.4'
> gunicorn.socket =  type=SocketKind.SOCK_STREAM, proto=0, laddr=/home/hello/wsp/app.sock>
> wsgi.errors =  0x7f20fa4288d0>
> wsgi.file_wrapper = ''
> wsgi.input = 
>
>
>
>
> kind  regards*,*
>
> Miracle.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CADZv-jBZojn_UhiYUgPZiP2tvcYnmggOVq24nUbCXCX_D0990A%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHV4E-d0iU5tYOPBeAVTuQLUgzVOM4v9Gu4s_rtxLqFFZr71dA%40mail.gmail.com.


Possible server attacks

2020-05-03 Thread Miracle
Hello django developers,

I might be experiencing a possible attack on my web server,  but I am not
sure yet.
Below is the email I got from my django.
I've gotten over 50 similar emails over the past 3 days.

Please, help me with this.


Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
'35.192.28.182' to ALLOWED_HOSTS.

Report at /SQlite/main.php

Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
'35.192.28.182' to ALLOWED_HOSTS.

Request Method: GET
Request URL: https://35.192.28.182/SQlite/main.php

Django Version: 2.2.8
Python Executable: /home/hello/wsp/env/bin/python3
Python Version: 3.6.9
Python Path: ['/home/hello/wsp', '/home/hello/wsp/env/bin',
'/usr/lib/python36.zip', '/usr/lib/python3.6',
'/usr/lib/python3.6/lib-dynload',
'/home/hello/wsp/env/lib/python3.6/site-packages']
Server time: Sun, 3 May 2020 19:22:55 +
Show quoted text
HTTP_ACCEPT =
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
HTTP_ACCEPT_LANGUAGE = 'en-GB,en-US;q=0.9,en;q=0.8,ig;q=0.7'
HTTP_CONNECTION = 'close'
HTTP_COOKIE =
'csrftoken=mX6nNccvMIycyGeE4tF0hciqwfsccdaK8X8ZDt8YgimJeQYTjQFjxfB4YGNCZ9Ik;
sessionid=mbmg0dvoz2tebman7ereia9eue59wto7'
HTTP_HOST = '35.192.28.182'
HTTP_SAVE_DATA = 'on'

HTTP_SEC_FETCH_DEST = 'document'
HTTP_SEC_FETCH_MODE = 'navigate'
HTTP_SEC_FETCH_SITE = 'none'
HTTP_UPGRADE_INSECURE_REQUESTS = '1'
HTTP_USER_AGENT = 'Mozilla/5.0 (Linux; Android 9; SM-A307FN)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.117 Mobile
Safari/537.36'
HTTP_X_FORWARDED_FOR = '197.211.61.210'
HTTP_X_FORWARDED_PROTO = 'https'
HTTP_X_REAL_IP = '197.211.61.210'
PATH_INFO = '/SQlite/main.php'
QUERY_STRING = ''
RAW_URI = '/SQlite/main.php'
REMOTE_ADDR = ''
REQUEST_METHOD = 'GET'
SCRIPT_NAME = ''
SERVER_NAME = '35.192.28.182'
SERVER_PORT = '443'
SERVER_PROTOCOL = 'HTTP/1.0'
SERVER_SOFTWARE = 'gunicorn/20.0.4'
gunicorn.socket = 
wsgi.errors = 
wsgi.file_wrapper = ''
wsgi.input = 




kind  regards*,*

Miracle.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADZv-jBZojn_UhiYUgPZiP2tvcYnmggOVq24nUbCXCX_D0990A%40mail.gmail.com.


Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-03 Thread Jorge Gimeno
On Sun, May 3, 2020 at 1:04 PM Iain Stewart 
wrote:

> Hi Famzaa,
>
> I have made migrations but the admin interface is not finding the database
> perhaps? I get this exception:
>
> Exception Location: 
> C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py
> in execute, line 296
>
> Any help much appreciated.
>
> Iain
>
> On Sunday, 3 May 2020 00:06:57 UTC+1, Famzaa wrote:
>>
>> first run makemigrations and then migrate to create table if you see the
>> model name in  admin section this means that the table is created sometimes
>> this happens when you make changes to the model and don't run migrations.
>>
>> On Sat, May 2, 2020 at 10:33 PM Jorge Gimeno  wrote:
>>
>>>
>>>
>>> On Sat, May 2, 2020 at 7:43 AM Iain Stewart  wrote:
>>>
 Hi Folks,

 I am a learner and am enjoying learning Django so far (about a month
 in). I am doing the Mosh Python Tutorial for Begnniners on You Tube and in
 trying to save my first product on the Django admin/ products page and got
 the following error. I suspect the problem is between Django and SQLite.
 Any possible solution would be appreciated. Thanks!
 Request Method: POST Request URL: 
 http://127.0.0.1:8000/admin/products/product/add/

 
  Django
 Version: 2.1 Python Version: 3.7.7 Installed Applications: 
 ['django.contrib.admin',
 'django.contrib.auth', 'django.contrib.contenttypes', 
 'django.contrib.sessions',
 'django.contrib.messages', 'django.contrib.staticfiles', 
 'products.apps.ProductsConfig']
 Installed Middleware: ['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware', 
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware', 
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware', 
 'django.middleware.clickjacking.XFrameOptionsMiddleware']
 Traceback: File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\
 utils.py
 "
 in _execute 85. return self.cursor.execute(sql, params) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\
 base.py
 "
 in execute 296. return Database.Cursor.execute(self, query, params) The
 above exception (no such table: main.auth_user__old) was the direct cause
 of the following exception: File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
 exception.py
 "
 in inner 34. response = get_response(request) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
 base.py
 "
 in _get_response 126. response =
 self.process_exception_by_middleware(e, request) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
 base.py
 "
 in _get_response 124. response = wrapped_callback(request,
 *callback_args, **callback_kwargs) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
 options.py
 "
 in wrapper 607. return self.admin_site.admin_view(view)(*args,
 **kwargs) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\
 decorators.py
 "
 in _wrapped_view 142. response = view_func(request, *args, **kwargs) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\views\decorators\
 cache.py
 

Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-03 Thread Iain Stewart
Hi Famzaa,

I have made migrations but the admin interface is not finding the database 
perhaps? I get this exception:

Exception Location: 
C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py
 
in execute, line 296

Any help much appreciated.

Iain

On Sunday, 3 May 2020 00:06:57 UTC+1, Famzaa wrote:
>
> first run makemigrations and then migrate to create table if you see the 
> model name in  admin section this means that the table is created sometimes 
> this happens when you make changes to the model and don't run migrations.
>
> On Sat, May 2, 2020 at 10:33 PM Jorge Gimeno  > wrote:
>
>>
>>
>> On Sat, May 2, 2020 at 7:43 AM Iain Stewart > > wrote:
>>
>>> Hi Folks,
>>>
>>> I am a learner and am enjoying learning Django so far (about a month 
>>> in). I am doing the Mosh Python Tutorial for Begnniners on You Tube and in 
>>> trying to save my first product on the Django admin/ products page and got 
>>> the following error. I suspect the problem is between Django and SQLite. 
>>> Any possible solution would be appreciated. Thanks!
>>> Request Method: POST Request URL: 
>>> http://127.0.0.1:8000/admin/products/product/add/ 
>>>
>>> 
>>>  Django 
>>> Version: 2.1 Python Version: 3.7.7 Installed Applications: 
>>> ['django.contrib.admin', 
>>> 'django.contrib.auth', 'django.contrib.contenttypes', 
>>> 'django.contrib.sessions', 
>>> 'django.contrib.messages', 'django.contrib.staticfiles', 
>>> 'products.apps.ProductsConfig'] 
>>> Installed Middleware: ['django.middleware.security.SecurityMiddleware', 
>>> 'django.contrib.sessions.middleware.SessionMiddleware', 
>>> 'django.middleware.common.CommonMiddleware', 
>>> 'django.middleware.csrf.CsrfViewMiddleware', 
>>> 'django.contrib.auth.middleware.AuthenticationMiddleware', 
>>> 'django.contrib.messages.middleware.MessageMiddleware', 
>>> 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback: File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\
>>> utils.py 
>>> "
>>>  
>>> in _execute 85. return self.cursor.execute(sql, params) File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\
>>> base.py 
>>> "
>>>  
>>> in execute 296. return Database.Cursor.execute(self, query, params) The 
>>> above exception (no such table: main.auth_user__old) was the direct cause 
>>> of the following exception: File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>>> exception.py 
>>> "
>>>  
>>> in inner 34. response = get_response(request) File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>>> base.py 
>>> "
>>>  
>>> in _get_response 126. response = 
>>> self.process_exception_by_middleware(e, request) File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>>> base.py 
>>> "
>>>  
>>> in _get_response 124. response = wrapped_callback(request, 
>>> *callback_args, **callback_kwargs) File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
>>> options.py 
>>> "
>>>  
>>> in wrapper 607. return self.admin_site.admin_view(view)(*args, 
>>> **kwargs) File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\
>>> decorators.py 
>>> "
>>>  
>>> in _wrapped_view 142. response = view_func(request, *args, **kwargs) File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\views\decorators\
>>> cache.py 
>>> 

Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-03 Thread Iain Stewart
Hi Jorge,

I have made migrations but the admin interface is not finding the database 
perhaps? I get this exception:

Exception Location: 
C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py
 
in execute, line 296

Any help much appreciated.

Iain
On Saturday, 2 May 2020 18:34:03 UTC+1, jlgimeno71 wrote:
>
>
>
> On Sat, May 2, 2020 at 7:43 AM Iain Stewart  > wrote:
>
>> Hi Folks,
>>
>> I am a learner and am enjoying learning Django so far (about a month 
>> in). I am doing the Mosh Python Tutorial for Begnniners on You Tube and in 
>> trying to save my first product on the Django admin/ products page and got 
>> the following error. I suspect the problem is between Django and SQLite. 
>> Any possible solution would be appreciated. Thanks!
>> Request Method: POST Request URL: 
>> http://127.0.0.1:8000/admin/products/product/add/ 
>>
>> 
>>  Django 
>> Version: 2.1 Python Version: 3.7.7 Installed Applications: 
>> ['django.contrib.admin', 
>> 'django.contrib.auth', 'django.contrib.contenttypes', 
>> 'django.contrib.sessions', 
>> 'django.contrib.messages', 'django.contrib.staticfiles', 
>> 'products.apps.ProductsConfig'] 
>> Installed Middleware: ['django.middleware.security.SecurityMiddleware', 
>> 'django.contrib.sessions.middleware.SessionMiddleware', 
>> 'django.middleware.common.CommonMiddleware', 
>> 'django.middleware.csrf.CsrfViewMiddleware', 
>> 'django.contrib.auth.middleware.AuthenticationMiddleware', 
>> 'django.contrib.messages.middleware.MessageMiddleware', 
>> 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback: File 
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\
>> utils.py 
>> "
>>  
>> in _execute 85. return self.cursor.execute(sql, params) File 
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\
>> base.py 
>> "
>>  
>> in execute 296. return Database.Cursor.execute(self, query, params) The 
>> above exception (no such table: main.auth_user__old) was the direct cause 
>> of the following exception: File 
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>> exception.py 
>> "
>>  
>> in inner 34. response = get_response(request) File 
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>> base.py 
>> "
>>  
>> in _get_response 126. response = self.process_exception_by_middleware(e, 
>> request) File 
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>> base.py 
>> "
>>  
>> in _get_response 124. response = wrapped_callback(request, 
>> *callback_args, **callback_kwargs) File 
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
>> options.py 
>> "
>>  
>> in wrapper 607. return self.admin_site.admin_view(view)(*args, **kwargs) 
>> File 
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\
>> decorators.py 
>> "
>>  
>> in _wrapped_view 142. response = view_func(request, *args, **kwargs) File 
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\views\decorators\
>> cache.py 
>> "
>>  
>> in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) 
>> File 
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
>> sites.py 
>> 

Re: OperationalError at /admin/login/attempt to write a readonly database

2020-05-03 Thread ramadhan ngallen
In short, it happens when the application which writes to the sqlite database 
does not have write permission.

You have to add writing rights to the directory in which your sqlite database 
is stored. So running chmod 664 /srv/mysite should help.
This is a security risk, so better solution is to change the owner of your 
database to www-data:
chown www-data:www-data /srv/mysite
chown www-data:www-data /srv/mysite/DATABASE.sqlite
On 3 May 2020, 22:31 +0300, Amina Anna Mahamane.O , wrote:
>
> 
> Envoyé de mon iPhone
>
> > Le 3 mai 2020 à 15:25, Jorge Gimeno  a écrit :
> >
> >
> >
> > > On Sun, May 3, 2020 at 3:46 AM Amina Anna Mahamane.O 
> > >  wrote:
> > > > I read , but I didn’t help me , I don’t really know hiw to process . 
> > > > Can you explain me ?
> > >
> > > I'm not a linux expert, so other folks can feel free to correct me.
> > >
> > > In linux, the user that creates the file in a directory they have access 
> > > to has "ownership" of the file.  With that, the user can both read and 
> > > write to the file.  All other users (except for sudo users, I believe) 
> > > have read-only access by default.
> > >
> > > That's what's happening here.  When you ran migrations as the currently 
> > > logged in user, your user has read and write permissions.  Apache, 
> > > however, runs as a different user, so it cannot write to the database.
> > >
> > > That answer I linked did have some things to try, in addition to a link 
> > > to more general question about permissions.  The file you would need to 
> > > change permissioins on (since you're using sqlite3, which is file based) 
> > > is named (without quotes) "db.sqlite3'.
> > >
> > > Hope this helps!
> > >
> > > -Jorge
> > > >
> > > > Envoyé de mon iPhone
> > > >
> > > > > Le 3 mai 2020 à 05:21, Jorge Gimeno  a écrit :
> > > > >
> > > > >
> > > > >
> > > > > > On Sat, May 2, 2020 at 8:09 PM Amina Anna Mahamane.O 
> > > > > >  wrote:
> > > > > > > Hello , I started learning how to use django . I made a project 
> > > > > > > without a virtual environnement and without apach2 andn mod wsgi .
> > > > > > > Now am I trying to do a project with those ones . I am a beginner 
> > > > > > > .When I try to log in to the administration interface, the error 
> > > > > > > below appears.I've been looking for solutions on the internet for 
> > > > > > > hours and hours but I didn't find anything which can help me to 
> > > > > > > solve my problem. I have no idea what could have caused this 
> > > > > > > error.I really need help, it's urgent. I wish someone can answer 
> > > > > > > to me in french but if it is not possible, help me anyway, I will 
> > > > > > > manage.
> > > > > > >
> > > > > > > OperationalError at /admin/login/
> > > > > > > attempt to write a readonly database
> > > > > > > Request Method:
> > > > > > > POST
> > > > > > > Request URL:
> > > > > > > http://www.djangoproject.localhost/admin/login/?next=/admin/
> > > > > > > Django Version:
> > > > > > > 3.0.5
> > > > > > > Exception Type:
> > > > > > > OperationalError
> > > > > > > Exception Value:
> > > > > > > attempt to write a readonly database
> > > > > > > Exception Location:
> > > > > > > /home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py
> > > > > > >  in execute, line 396
> > > > > > > Python Executable:
> > > > > > > /home/kirikou/mysite/env/bin/python
> > > > > > > Python Version:
> > > > > > > 3.7.5
> > > > > > > Python Path:
> > > > > > > ['/home/kirikou/mysite',
> > > > > > > '/usr/lib/python37.zip',
> > > > > > > '/usr/lib/python3.7',
> > > > > > > '/usr/lib/python3.7/lib-dynload',
> > > > > > > '/home/kirikou/mysite/env/lib/python3.7/site-packages']
> > > > > > > Server time:
> > > > > > > Sat, 2 May 2020 21:39:20 +
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Environment:
> > > > > > >
> > > > > > >
> > > > > > > Request Method: POST
> > > > > > > Request URL: 
> > > > > > > http://www.djangoproject.localhost/admin/login/?next=/admin/
> > > > > > >
> > > > > > > Django Version: 3.0.5
> > > > > > > Python Version: 3.7.5
> > > > > > > Installed Applications:
> > > > > > > ['applis.apps.ApplisConfig',
> > > > > > >  'django.contrib.admin',
> > > > > > >  'django.contrib.auth',
> > > > > > >  'django.contrib.contenttypes',
> > > > > > >  'django.contrib.sessions',
> > > > > > >  'django.contrib.messages',
> > > > > > >  'django.contrib.staticfiles',
> > > > > > >  'django.contrib.admindocs']
> > > > > > > Installed Middleware:
> > > > > > > ['django.middleware.security.SecurityMiddleware',
> > > > > > >  'django.contrib.sessions.middleware.SessionMiddleware',
> > > > > > >  'django.middleware.common.CommonMiddleware',
> > > > > > >  'django.middleware.csrf.CsrfViewMiddleware',
> > > > > > >  'django.contrib.auth.middleware.AuthenticationMiddleware',
> > > > > > >  'django.contrib.messages.middleware.MessageMiddleware',
> > > > > > >  'django.middleware.clickjacking.XFrameOptionsMiddleware']
> > > > > > >
> > > > > > >
> > > > > 

Re: OperationalError at /admin/login/attempt to write a readonly database

2020-05-03 Thread Amina Anna Mahamane.O
I changed the permissions,but nothing changed .

Envoyé de mon iPhone

> Le 3 mai 2020 à 15:25, Jorge Gimeno  a écrit :
> 
> 
> 
> 
>> On Sun, May 3, 2020 at 3:46 AM Amina Anna Mahamane.O  
>> wrote:
>> I read , but I didn’t help me , I don’t really know hiw to process . Can you 
>> explain me ? 
> 
> I'm not a linux expert, so other folks can feel free to correct me.
> 
> In linux, the user that creates the file in a directory they have access to 
> has "ownership" of the file.  With that, the user can both read and write to 
> the file.  All other users (except for sudo users, I believe) have read-only 
> access by default.
> 
> That's what's happening here.  When you ran migrations as the currently 
> logged in user, your user has read and write permissions.  Apache, however, 
> runs as a different user, so it cannot write to the database.
> 
> That answer I linked did have some things to try, in addition to a link to 
> more general question about permissions.  The file you would need to change 
> permissioins on (since you're using sqlite3, which is file based) is named 
> (without quotes) "db.sqlite3'.
> 
> Hope this helps!
> 
> -Jorge
>> 
>> Envoyé de mon iPhone
>> 
 Le 3 mai 2020 à 05:21, Jorge Gimeno  a écrit :
 
>>> 
>>> 
>>> 
 On Sat, May 2, 2020 at 8:09 PM Amina Anna Mahamane.O  
 wrote:
 Hello , I started learning how to use django . I made a project without a 
 virtual environnement and without apach2 andn mod wsgi .
 Now am I trying to do a project with those ones . I am a beginner .When I 
 try to log in to the administration interface, the error below 
 appears.I've been looking for solutions on the internet for hours and 
 hours but I didn't find anything which can help me to solve my problem. I 
 have no idea what could have caused this error.I really need help, it's 
 urgent. I wish someone can answer to me in french but if it is not 
 possible, help me anyway, I will manage.
 
 OperationalError at /admin/login/
 
 attempt to write a readonly database
 Request Method:POST
 Request URL:   
 http://www.djangoproject.localhost/admin/login/?next=/admin/
 Django Version:3.0.5
 Exception Type:OperationalError
 Exception Value:   
 attempt to write a readonly database
 Exception Location:
 /home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py
  in execute, line 396
 Python Executable: /home/kirikou/mysite/env/bin/python
 Python Version:3.7.5
 Python Path:   
 ['/home/kirikou/mysite',
  '/usr/lib/python37.zip',
  '/usr/lib/python3.7',
  '/usr/lib/python3.7/lib-dynload',
  '/home/kirikou/mysite/env/lib/python3.7/site-packages']
 Server time:   Sat, 2 May 2020 21:39:20 +
 
 
 
 Environment:
 
 
 Request Method: POST
 Request URL: http://www.djangoproject.localhost/admin/login/?next=/admin/
 
 Django Version: 3.0.5
 Python Version: 3.7.5
 Installed Applications:
 ['applis.apps.ApplisConfig',
  'django.contrib.admin',
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.messages',
  'django.contrib.staticfiles',
  'django.contrib.admindocs']
 Installed Middleware:
 ['django.middleware.security.SecurityMiddleware',
  'django.contrib.sessions.middleware.SessionMiddleware',
  'django.middleware.common.CommonMiddleware',
  'django.middleware.csrf.CsrfViewMiddleware',
  'django.contrib.auth.middleware.AuthenticationMiddleware',
  'django.contrib.messages.middleware.MessageMiddleware',
  'django.middleware.clickjacking.XFrameOptionsMiddleware']
 
 
 
 Traceback (most recent call last):
   File 
 "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/utils.py",
  line 86, in _execute
 return self.cursor.execute(sql, params)
   File 
 "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py",
  line 396, in execute
 return Database.Cursor.execute(self, query, params)
 
 The above exception (attempt to write a readonly database) was the direct 
 cause of the following exception:
   File 
 "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/exception.py",
  line 34, in inner
 response = get_response(request)
   File 
 "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/base.py",
  line 115, in _get_response
 response = self.process_exception_by_middleware(e, request)
   File 
 "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/base.py",
  line 113, in _get_response
 response = wrapped_callback(request, *callback_args, **callback_kwargs)
   File 
 

Re: Re:

2020-05-03 Thread Motaz Hejaze
first remove all whitespaces in urls.py

' login' should be 'login'

and then rename your login view to something else , maybe custom_login , or
put your app urls before admin panel urls

On Sun, May 3, 2020 at 6:42 PM fahad rasool 
wrote:

> Apps url.py
>
> On Sun, 3 May 2020, 8:27 pm 'Amitesh Sahay' via Django users, <
> django-users@googlegroups.com> wrote:
>
>> please show your app's urls.py, as well the errors
>>
>> Regards,
>> Amitesh
>>
>>
>> On Sunday, 3 May, 2020, 07:53:47 pm IST, fahad rasool <
>> rasoolfahad...@gmail.com> wrote:
>>
>>
>> Than also it is not working
>>
>> On Sun, 3 May 2020, 7:44 pm 'Amitesh Sahay' via Django users, <
>> django-users@googlegroups.com> wrote:
>>
>> it should be *return redirect('login')*
>>
>> please check
>>
>> On Sunday, 3 May, 2020, 07:34:11 pm IST, fahad rasool <
>> rasoolfahad...@gmail.com> wrote:
>>
>>
>>
>> I am unable to redirect to my login page from signup page and nor i am
>> able to store sign up form details in the database .please someone help its
>> urgent..
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACqgSmBdoviTSbHH%3D8yMo86MO6vpGpHyNQz1FtXgRf-UiL7zYw%40mail.gmail.com
>> 
>> .
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/660971716.362954.1588515193796%40mail.yahoo.com
>> 
>> .
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACqgSmAwKgU4dVWN72-u2xnvqBz5ThV6CNarukWo%2BFACwN%3DGFQ%40mail.gmail.com
>> 
>> .
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/940225696.366548.1588517794311%40mail.yahoo.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACqgSmDYKr5ztuh3meeTCt-fQvnC9OjZ1cMFK2pFAw%3DLM%2BnLoA%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHV4E-csZDBbNz5HKHpto_6mtn%2B2jLOLAzjSgV95dDPX72NfhQ%40mail.gmail.com.


How to get previously uploaded Images in Django

2020-05-03 Thread Ahmed Khairy


I am using Django 2.2 to make a project where designers upload designs and 
when I want to post them from admin, I want to choose their names and after 
I choose their names only their designs appear in the drop down list. So 
far I have reach the reach the designer name in a drop down list but I 
don't know how to link only their designs in the designs drop list.

I am using 2 different apps: 1."Score" where designers can upload their 
designs
2."Core" where I can list the items

First in the Score .model where designers upload the designs

class Post(models.Model):
designer_name = models.ForeignKey(User, on_delete=models.CASCADE)
design = models.ImageField(
blank=False, null=True, upload_to='new designs')
title = models.CharField(max_length=100)

def __str__(self):
return self.title

def get_absolute_url(self):
return reverse("score:post-detail", kwargs={"pk": self.pk})

Second in the Core App Model:

class Item(models.Model):
title = models.CharField(max_length=100)
description = models.TextField()
price = models.FloatField()
designer_name = models.ForeignKey(User, on_delete=models.CASCADE)
image = models.ImageField(blank=False, upload_to='imgs') **How can I make 
this a drop down list with the selected user's (designer's) all previously 
uploaded images to choose from instead of uploading new images**


def __str__(self):
return self.title

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c25a66ad-ba1d-4351-89b6-53698b96997d%40googlegroups.com.


Re: not a valid UUID.

2020-05-03 Thread Motaz Hejaze
Great

On Sun, 3 May 2020, 4:49 pm Benedict Uwazie,  wrote:

> Thanks for your response I just found out u can't shorten UUID but I
> needed 12 digits
> what I now did was to import  the code below
> from random import randint
> my_rand = randint(1000, )
> transaction_id = models.CharField(max_length=30, unique=True, null=True,
> blank=True, editable=False, default=my_rand)
>
> Thanks
> On Sunday, 3 May 2020 11:35:30 UTC+1, Nomeh Uchenna Gabriel wrote:
>>
>> On Sunday, May 3, 2020 at 9:10:28 AM UTC+1, Benedict Uwazie wrote:
>> > Still facing the same issue
>> >
>> > On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze  wrote:
>> > default=cast_trans
>> > cast_trans = int(pass_trans)
>> >
>> > UUID is string not int
>> >
>> >
>> > On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie 
>> wrote:
>> >
>> >
>> >
>> > On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie  wrote:
>> >
>> > I added a field called transaction_id in my models.py I want that field
>> to be used to track every transaction on my "DuesLevy" model I
>> imported uuid to this to happen, but each time I migrate I get this error.
>> > How do i prevent this error from occurring each time I migrate (python
>> manage.py migrate) File
>> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>> line 2344, in to_python
>> > params={'value': value},
>> > django.core.exceptions.ValidationError: ["'13615773708697' is not a
>> valid UUID."]
>> >
>> >
>> > my models.py
>> >
>> >
>> > trans_id = uuid.uuid4()
>> > trans_str = trans_id.int
>> > pass_trans = str(trans_str)[:12]
>> > cast_trans = int(pass_trans)
>> > class DuesLevy(models.Model):
>> >
>> class_of_dues = models.CharField(max_length=30, default=options.CHOOSE, 
>> choices=options.CLASS_OF_DUES, blank=True)
>>
>> >
>> payment_circle = models.CharField(max_length=30, default=options.CHOOSE, 
>> choices=options.PAYMENT_CIRCLE)
>>
>> >
>> payment_option = models.CharField(max_length=30, default=options.CHOOSE, 
>> choices=options.PAYMENT_OPTION)
>>
>> > amount = models.DecimalField(max_digits=8, decimal_places=2)
>> >
>> transaction_id = models.UUIDField(max_length=100, unique=True, 
>> null=True, blank=True, editable=False, default=cast_trans)
>>
>> >
>> payment_channel = models.CharField(max_length=30, 
>> default=options.CHOOSE, choices=options.PAYMENT_CHANNEL_TYPE)
>>
>> > payment_date = models.DateField()
>> > date_recorded = models.DateTimeField(auto_now_add=True)
>> >
>> user = models.ForeignKey(settings.AUTH_USER_MODEL, 
>> on_delete=models.CASCADE)
>>
>> > description = models.TextField(blank=True, null=True)
>> >
>> > def __str__(self):
>> > return self.amount
>> >
>> >
>> > def get_absolute_url(self):
>> > return reverse('backend:detail_dues', kwargs={'pk': self.id})
>> >
>> >
>> >
>> >
>> >
>> >
>> > --
>> >
>> > 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/4a1d77cc-d1b8-4bd4-84cd-cd78e6d2eb76%40googlegroups.com.
>>
>>
>>
>>
>> On Sunday, May 3, 2020 at 9:10:28 AM UTC+1, Benedict Uwazie wrote:
>> > Still facing the same issue
>> >
>> > On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze  wrote:
>> > default=cast_trans
>> > cast_trans = int(pass_trans)
>> >
>> > UUID is string not int
>> >
>> >
>> > On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie 
>> wrote:
>> >
>> >
>> >
>> > On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie  wrote:
>> >
>> > I added a field called transaction_id in my models.py I want that field
>> to be used to track every transaction on my "DuesLevy" model I
>> imported uuid to this to happen, but each time I migrate I get this error.
>> > How do i prevent this error from occurring each time I migrate (python
>> manage.py migrate) File
>> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>> line 2344, in to_python
>> > params={'value': value},
>> > django.core.exceptions.ValidationError: ["'13615773708697' is not a
>> valid UUID."]
>> >
>> >
>> > my models.py
>> >
>> >
>> > trans_id = uuid.uuid4()
>> > trans_str = trans_id.int
>> > pass_trans = str(trans_str)[:12]
>> > cast_trans = int(pass_trans)
>> > class DuesLevy(models.Model):
>> >
>> class_of_dues = models.CharField(max_length=30, default=options.CHOOSE, 
>> choices=options.CLASS_OF_DUES, blank=True)
>>
>> >
>> payment_circle = models.CharField(max_length=30, default=options.CHOOSE, 
>> choices=options.PAYMENT_CIRCLE)
>>
>> >
>> payment_option = models.CharField(max_length=30, default=options.CHOOSE, 
>> choices=options.PAYMENT_OPTION)
>>
>> > amount = models.DecimalField(max_digits=8, decimal_places=2)
>> >
>> transaction_id = 

Re: Form not visible on the add page

2020-05-03 Thread 'Amitesh Sahay' via Django users
did you migrate the MODEL?


Regards,
Amitesh Sahay91-750 797 8619 

On Sunday, 3 May, 2020, 08:15:32 pm IST, Jorge Gimeno 
 wrote:  
 
 

On Sun, May 3, 2020 at 7:34 AM Vikram Jaiswal 
 wrote:

I am not able to see the form on admin page to add the dataFirst  -First
 -settings.py -urls.py
  -travello -migrations -urls.py 
-models.py -admin.py
here is the models.pyfrom django.db import models
# Create your models here.class Destination(models.Model): #id : int name : 
models.CharField(max_length=100)#str img : 
models.ImageField(upload_to='pics')#str desc : 
models.CharField(max_length=100)#str price : models.IntegerField()#int offer : 
models.BooleanField(default=False)#bool

here is the admin.pyfrom django.contrib import adminfrom travello.models import 
Destination



# Register your models here.admin.site.register(Destination)
Please 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6f1d4cad-2d83-454d-b49b-7eaaef5b0ea8%40googlegroups.com.


This is related to your previous post.  The fields aren't showing up, and they 
won't until they are properly defined and the database migration is done.
-Jorge


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK9NwDKE8o0zcJMatAZpCYBm5WvDLgZbuxZFxfw4LZPu2A%40mail.gmail.com.
  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1505356251.370458.1588517911879%40mail.yahoo.com.


Re: Re:

2020-05-03 Thread 'Amitesh Sahay' via Django users
please show your app's urls.py, as well the errors


Regards,
Amitesh 

On Sunday, 3 May, 2020, 07:53:47 pm IST, fahad rasool 
 wrote:  
 
 Than also it is not working
On Sun, 3 May 2020, 7:44 pm 'Amitesh Sahay' via Django users, 
 wrote:

it should be return redirect('login')


please check
On Sunday, 3 May, 2020, 07:34:11 pm IST, fahad rasool 
 wrote:  
 
 
I am unable to redirect to my login page from signup page and nor i am able to 
store sign up form details in the database .please someone help its urgent..

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACqgSmBdoviTSbHH%3D8yMo86MO6vpGpHyNQz1FtXgRf-UiL7zYw%40mail.gmail.com.
  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/660971716.362954.1588515193796%40mail.yahoo.com.



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACqgSmAwKgU4dVWN72-u2xnvqBz5ThV6CNarukWo%2BFACwN%3DGFQ%40mail.gmail.com.
  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/940225696.366548.1588517794311%40mail.yahoo.com.


Re: not a valid UUID.

2020-05-03 Thread Benedict Uwazie
Thanks for your response I just found out u can't shorten UUID but I needed 
12 digits
what I now did was to import  the code below
from random import randint
my_rand = randint(1000, )
transaction_id = models.CharField(max_length=30, unique=True, null=True, 
blank=True, editable=False, default=my_rand)

Thanks
On Sunday, 3 May 2020 11:35:30 UTC+1, Nomeh Uchenna Gabriel wrote:
>
> On Sunday, May 3, 2020 at 9:10:28 AM UTC+1, Benedict Uwazie wrote: 
> > Still facing the same issue 
> > 
> > On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze  wrote: 
> > default=cast_trans 
> > cast_trans = int(pass_trans) 
> > 
> > UUID is string not int 
> > 
> > 
> > On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie  
> wrote: 
> > 
> > 
> > 
> > On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie  wrote: 
> > 
> > I added a field called transaction_id in my models.py I want that field 
> to be used to track every transaction on my "DuesLevy" model I 
> imported uuid to this to happen, but each time I migrate I get this error. 
> > How do i prevent this error from occurring each time I migrate (python 
> manage.py migrate) File 
> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>  
> line 2344, in to_python 
> > params={'value': value}, 
> > django.core.exceptions.ValidationError: ["'13615773708697' is not a 
> valid UUID."] 
> > 
> > 
> > my models.py 
> > 
> > 
> > trans_id = uuid.uuid4() 
> > trans_str = trans_id.int 
> > pass_trans = str(trans_str)[:12] 
> > cast_trans = int(pass_trans) 
> > class DuesLevy(models.Model): 
> > 
> class_of_dues = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.CLASS_OF_DUES, blank=True) 
>
> > 
> payment_circle = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_CIRCLE) 
>
> > 
> payment_option = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_OPTION) 
>
> > amount = models.DecimalField(max_digits=8, decimal_places=2) 
> > 
> transaction_id = models.UUIDField(max_length=100, unique=True, null=True, 
> blank=True, editable=False, default=cast_trans) 
>
> > 
> payment_channel = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_CHANNEL_TYPE) 
>
> > payment_date = models.DateField() 
> > date_recorded = models.DateTimeField(auto_now_add=True) 
> > 
> user = models.ForeignKey(settings.AUTH_USER_MODEL, 
> on_delete=models.CASCADE) 
>
> > description = models.TextField(blank=True, null=True) 
> > 
> > def __str__(self): 
> > return self.amount 
> >  
> >
> > def get_absolute_url(self): 
> > return reverse('backend:detail_dues', kwargs={'pk': self.id}) 
> > 
> > 
> > 
> > 
> > 
> > 
> > -- 
> > 
> > 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/4a1d77cc-d1b8-4bd4-84cd-cd78e6d2eb76%40googlegroups.com.
>  
>
>
>
>
> On Sunday, May 3, 2020 at 9:10:28 AM UTC+1, Benedict Uwazie wrote: 
> > Still facing the same issue 
> > 
> > On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze  wrote: 
> > default=cast_trans 
> > cast_trans = int(pass_trans) 
> > 
> > UUID is string not int 
> > 
> > 
> > On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie  
> wrote: 
> > 
> > 
> > 
> > On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie  wrote: 
> > 
> > I added a field called transaction_id in my models.py I want that field 
> to be used to track every transaction on my "DuesLevy" model I 
> imported uuid to this to happen, but each time I migrate I get this error. 
> > How do i prevent this error from occurring each time I migrate (python 
> manage.py migrate) File 
> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>  
> line 2344, in to_python 
> > params={'value': value}, 
> > django.core.exceptions.ValidationError: ["'13615773708697' is not a 
> valid UUID."] 
> > 
> > 
> > my models.py 
> > 
> > 
> > trans_id = uuid.uuid4() 
> > trans_str = trans_id.int 
> > pass_trans = str(trans_str)[:12] 
> > cast_trans = int(pass_trans) 
> > class DuesLevy(models.Model): 
> > 
> class_of_dues = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.CLASS_OF_DUES, blank=True) 
>
> > 
> payment_circle = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_CIRCLE) 
>
> > 
> payment_option = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_OPTION) 
>
> > amount = models.DecimalField(max_digits=8, decimal_places=2) 
> > 
> transaction_id = models.UUIDField(max_length=100, unique=True, null=True, 
> blank=True, editable=False, 

Re: Form not visible on the add page

2020-05-03 Thread Jorge Gimeno
On Sun, May 3, 2020 at 7:34 AM Vikram Jaiswal <
vikramkumarjaiswal221...@gmail.com> wrote:

> I am not able to see the form on admin page to add the data
> First
>   -First
>  -settings.py
>  -urls.py
>   -travello
>  -migrations
>  -urls.py
>  -models.py
>  -admin.py
>
> here is the models.py
> from django.db import models
>
> # Create your models here.
> class Destination(models.Model):
> #id : int
> name : models.CharField(max_length=100)#str
> img : models.ImageField(upload_to='pics')#str
> desc : models.CharField(max_length=100)#str
> price : models.IntegerField()#int
> offer : models.BooleanField(default=False)#bool
>
>
> here is the admin.py
> from django.contrib import admin
> from travello.models import Destination
>
>
>
>
> # Register your models here.
> admin.site.register(Destination)
>
> Please 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6f1d4cad-2d83-454d-b49b-7eaaef5b0ea8%40googlegroups.com
> 
> .
>

This is related to your previous post.  The fields aren't showing up, and
they won't until they are properly defined and the database migration is
done.

-Jorge

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK9NwDKE8o0zcJMatAZpCYBm5WvDLgZbuxZFxfw4LZPu2A%40mail.gmail.com.


Re: Form is not getting displayed on django admin page

2020-05-03 Thread Jorge Gimeno
On Sun, May 3, 2020 at 7:34 AM Vikram Jaiswal <
vikramkumarjaiswal221...@gmail.com> wrote:

> above is the image of the error
> admin.py
> from django.contrib import admin
> from travello.models import Destination
>
>
>
> class ContactAdmin(admin.ModelAdmin):
> Clist_display = [ 'name', 'department', 'lalal']
> # Register your models here.
> admin.site.register(Destination,ContactAdmin)
>
>
> models.py
> from django.db import models
>
> # Create your models here.
> class Destination(models.Model):
> #id : int
> name : models.CharField(max_length=100)#str
> img : models.ImageField(upload_to='pics')#str
> desc : models.CharField(max_length=100)#str
> price : models.IntegerField()#int
> offer : models.BooleanField(default=False)#bool
>
>
> When i try to use
> python manage.py makemigrations
> then in 0001_inital.py only contains id attribute.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f60acf9d-d64d-4792-a9c1-5585d40758e6%40googlegroups.com
> 
> .
>

To create the fields in Python models, we have to set the name of the
attributes equal to the class of the field type.  In simpler terms, using
your model class and just the name attribute:

from django.db import models


class Destination(models.Model):
name = models.CharField(max_length=100)

Try setting the rest of the attributes using the assignment operator ('='),
then run migrations again.  You should see the fields in the admin.

-Jorge

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK85E13zVaOHuJA%2BMegWXq%2BSx%2BY8%2B7ymoUW4-9F-msikmw%40mail.gmail.com.


Form not visible on the add page

2020-05-03 Thread Vikram Jaiswal
I am not able to see the form on admin page to add the data
First
  -First
 -settings.py
 -urls.py
  -travello
 -migrations
 -urls.py
 -models.py
 -admin.py

here is the models.py
from django.db import models

# Create your models here.
class Destination(models.Model):
#id : int
name : models.CharField(max_length=100)#str
img : models.ImageField(upload_to='pics')#str
desc : models.CharField(max_length=100)#str
price : models.IntegerField()#int
offer : models.BooleanField(default=False)#bool


here is the admin.py
from django.contrib import admin
from travello.models import Destination




# Register your models here.
admin.site.register(Destination)

Please 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6f1d4cad-2d83-454d-b49b-7eaaef5b0ea8%40googlegroups.com.


Form is not getting displayed on django admin page

2020-05-03 Thread Vikram Jaiswal
above is the image of the error
admin.py
from django.contrib import admin
from travello.models import Destination



class ContactAdmin(admin.ModelAdmin):
Clist_display = [ 'name', 'department', 'lalal']
# Register your models here.
admin.site.register(Destination,ContactAdmin)


models.py
from django.db import models

# Create your models here.
class Destination(models.Model):
#id : int
name : models.CharField(max_length=100)#str
img : models.ImageField(upload_to='pics')#str
desc : models.CharField(max_length=100)#str
price : models.IntegerField()#int
offer : models.BooleanField(default=False)#bool


When i try to use
python manage.py makemigrations
then in 0001_inital.py only contains id attribute.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f60acf9d-d64d-4792-a9c1-5585d40758e6%40googlegroups.com.


Re: OperationalError at /admin/login/attempt to write a readonly database

2020-05-03 Thread Jorge Gimeno
On Sun, May 3, 2020 at 3:46 AM Amina Anna Mahamane.O 
wrote:

> I read , but I didn’t help me , I don’t really know hiw to process . Can
> you explain me ?
>

I'm not a linux expert, so other folks can feel free to correct me.

In linux, the user that creates the file in a directory they have access to
has "ownership" of the file.  With that, the user can both read and write
to the file.  All other users (except for sudo users, I believe) have
read-only access by default.

That's what's happening here.  When you ran migrations as the currently
logged in user, your user has read and write permissions.  Apache, however,
runs as a different user, so it cannot write to the database.

That answer I linked did have some things to try, in addition to a link to
more general question about permissions.  The file you would need to change
permissioins on (since you're using sqlite3, which is file based) is named
(without quotes) "db.sqlite3'.

Hope this helps!

-Jorge

>
> Envoyé de mon iPhone
>
> Le 3 mai 2020 à 05:21, Jorge Gimeno  a écrit :
>
> 
>
>
> On Sat, May 2, 2020 at 8:09 PM Amina Anna Mahamane.O 
> wrote:
>
>> Hello , I started learning how to use django . I made a project without a
>> virtual environnement and without apach2 andn mod wsgi .
>> Now am I trying to do a project with those ones . I am a beginner .When
>> I try to log in to the administration interface, the error below appears.I've
>> been looking for solutions on the internet for hours and hours but I didn't
>> find anything which can help me to solve my problem. I have no idea what
>> could have caused this error.I really need help, it's urgent. I wish
>> someone can answer to me in french but if it is not possible, help me
>> anyway, I will manage.
>>
>> OperationalError at /admin/login/
>>
>> attempt to write a readonly database
>>
>> Request Method: POST
>> Request URL: http://www.djangoproject.localhost/admin/login/?next=/admin/
>> Django Version: 3.0.5
>> Exception Type: OperationalError
>> Exception Value:
>>
>> attempt to write a readonly database
>>
>> Exception Location: 
>> /home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py
>> in execute, line 396
>> Python Executable: /home/kirikou/mysite/env/bin/python
>> Python Version: 3.7.5
>> Python Path:
>>
>> ['/home/kirikou/mysite',
>>  '/usr/lib/python37.zip',
>>  '/usr/lib/python3.7',
>>  '/usr/lib/python3.7/lib-dynload',
>>  '/home/kirikou/mysite/env/lib/python3.7/site-packages']
>>
>> Server time: Sat, 2 May 2020 21:39:20 +
>>
>>
>>
>> Environment:
>>
>>
>> Request Method: POST
>> Request URL: http://www.djangoproject.localhost/admin/login/?next=/admin/
>>
>> Django Version: 3.0.5
>> Python Version: 3.7.5
>> Installed Applications:
>> ['applis.apps.ApplisConfig',
>>  'django.contrib.admin',
>>  'django.contrib.auth',
>>  'django.contrib.contenttypes',
>>  'django.contrib.sessions',
>>  'django.contrib.messages',
>>  'django.contrib.staticfiles',
>>  'django.contrib.admindocs']
>> Installed Middleware:
>> ['django.middleware.security.SecurityMiddleware',
>>  'django.contrib.sessions.middleware.SessionMiddleware',
>>  'django.middleware.common.CommonMiddleware',
>>  'django.middleware.csrf.CsrfViewMiddleware',
>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>  'django.contrib.messages.middleware.MessageMiddleware',
>>  'django.middleware.clickjacking.XFrameOptionsMiddleware']
>>
>>
>>
>> Traceback (most recent call last):
>>   File
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/utils.py",
>> line 86, in _execute
>> return self.cursor.execute(sql, params)
>>   File
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py",
>> line 396, in execute
>> return Database.Cursor.execute(self, query, params)
>>
>> The above exception (attempt to write a readonly database) was the direct
>> cause of the following exception:
>>   File
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/exception.py",
>> line 34, in inner
>> response = get_response(request)
>>   File
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/base.py",
>> line 115, in _get_response
>> response = self.process_exception_by_middleware(e, request)
>>   File
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/base.py",
>> line 113, in _get_response
>> response = wrapped_callback(request, *callback_args,
>> **callback_kwargs)
>>   File
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/decorators/cache.py",
>> line 44, in _wrapped_view_func
>> response = view_func(request, *args, **kwargs)
>>   File
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/contrib/admin/sites.py",
>> line 407, in login
>> return LoginView.as_view(**defaults)(request)
>>   File
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/generic/base.py",
>> line 71, in view
>> return 

Re:

2020-05-03 Thread fahad rasool
Than also it is not working

On Sun, 3 May 2020, 7:44 pm 'Amitesh Sahay' via Django users, <
django-users@googlegroups.com> wrote:

> it should be *return redirect('login')*
>
> please check
>
> On Sunday, 3 May, 2020, 07:34:11 pm IST, fahad rasool <
> rasoolfahad...@gmail.com> wrote:
>
>
>
> I am unable to redirect to my login page from signup page and nor i am
> able to store sign up form details in the database .please someone help its
> urgent..
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACqgSmBdoviTSbHH%3D8yMo86MO6vpGpHyNQz1FtXgRf-UiL7zYw%40mail.gmail.com
> 
> .
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/660971716.362954.1588515193796%40mail.yahoo.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACqgSmAwKgU4dVWN72-u2xnvqBz5ThV6CNarukWo%2BFACwN%3DGFQ%40mail.gmail.com.


[no subject]

2020-05-03 Thread 'Amitesh Sahay' via Django users
it should be return redirect('login')


please check
On Sunday, 3 May, 2020, 07:34:11 pm IST, fahad rasool 
 wrote:  
 
 
I am unable to redirect to my login page from signup page and nor i am able to 
store sign up form details in the database .please someone help its urgent..

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACqgSmBdoviTSbHH%3D8yMo86MO6vpGpHyNQz1FtXgRf-UiL7zYw%40mail.gmail.com.
  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/660971716.362954.1588515193796%40mail.yahoo.com.


Re: OperationalError at /admin/login/attempt to write a readonly database

2020-05-03 Thread Amina Anna Mahamane.O
I read , but I didn’t help me , I don’t really know hiw to process . Can you 
explain me ? 

Envoyé de mon iPhone

> Le 3 mai 2020 à 05:21, Jorge Gimeno  a écrit :
> 
> 
> 
> 
>> On Sat, May 2, 2020 at 8:09 PM Amina Anna Mahamane.O  
>> wrote:
>> Hello , I started learning how to use django . I made a project without a 
>> virtual environnement and without apach2 andn mod wsgi .
>> Now am I trying to do a project with those ones . I am a beginner .When I 
>> try to log in to the administration interface, the error below appears.I've 
>> been looking for solutions on the internet for hours and hours but I didn't 
>> find anything which can help me to solve my problem. I have no idea what 
>> could have caused this error.I really need help, it's urgent. I wish someone 
>> can answer to me in french but if it is not possible, help me anyway, I will 
>> manage.
>> 
>> OperationalError at /admin/login/
>> 
>> attempt to write a readonly database
>> Request Method:  POST
>> Request URL: http://www.djangoproject.localhost/admin/login/?next=/admin/
>> Django Version:  3.0.5
>> Exception Type:  OperationalError
>> Exception Value: 
>> attempt to write a readonly database
>> Exception Location:  
>> /home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py
>>  in execute, line 396
>> Python Executable:   /home/kirikou/mysite/env/bin/python
>> Python Version:  3.7.5
>> Python Path: 
>> ['/home/kirikou/mysite',
>>  '/usr/lib/python37.zip',
>>  '/usr/lib/python3.7',
>>  '/usr/lib/python3.7/lib-dynload',
>>  '/home/kirikou/mysite/env/lib/python3.7/site-packages']
>> Server time: Sat, 2 May 2020 21:39:20 +
>> 
>> 
>> 
>> Environment:
>> 
>> 
>> Request Method: POST
>> Request URL: http://www.djangoproject.localhost/admin/login/?next=/admin/
>> 
>> Django Version: 3.0.5
>> Python Version: 3.7.5
>> Installed Applications:
>> ['applis.apps.ApplisConfig',
>>  'django.contrib.admin',
>>  'django.contrib.auth',
>>  'django.contrib.contenttypes',
>>  'django.contrib.sessions',
>>  'django.contrib.messages',
>>  'django.contrib.staticfiles',
>>  'django.contrib.admindocs']
>> Installed Middleware:
>> ['django.middleware.security.SecurityMiddleware',
>>  'django.contrib.sessions.middleware.SessionMiddleware',
>>  'django.middleware.common.CommonMiddleware',
>>  'django.middleware.csrf.CsrfViewMiddleware',
>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>  'django.contrib.messages.middleware.MessageMiddleware',
>>  'django.middleware.clickjacking.XFrameOptionsMiddleware']
>> 
>> 
>> 
>> Traceback (most recent call last):
>>   File 
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/utils.py",
>>  line 86, in _execute
>> return self.cursor.execute(sql, params)
>>   File 
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py",
>>  line 396, in execute
>> return Database.Cursor.execute(self, query, params)
>> 
>> The above exception (attempt to write a readonly database) was the direct 
>> cause of the following exception:
>>   File 
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/exception.py",
>>  line 34, in inner
>> response = get_response(request)
>>   File 
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/base.py",
>>  line 115, in _get_response
>> response = self.process_exception_by_middleware(e, request)
>>   File 
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/base.py",
>>  line 113, in _get_response
>> response = wrapped_callback(request, *callback_args, **callback_kwargs)
>>   File 
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/decorators/cache.py",
>>  line 44, in _wrapped_view_func
>> response = view_func(request, *args, **kwargs)
>>   File 
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/contrib/admin/sites.py",
>>  line 407, in login
>> return LoginView.as_view(**defaults)(request)
>>   File 
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/generic/base.py",
>>  line 71, in view
>> return self.dispatch(request, *args, **kwargs)
>>   File 
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/utils/decorators.py",
>>  line 43, in _wrapper
>> return bound_method(*args, **kwargs)
>>   File 
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/decorators/debug.py",
>>  line 76, in sensitive_post_parameters_wrapper
>> return view(request, *args, **kwargs)
>>   File 
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/utils/decorators.py",
>>  line 43, in _wrapper
>> return bound_method(*args, **kwargs)
>>   File 
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/utils/decorators.py",
>>  line 130, in _wrapped_view
>> response = view_func(request, *args, **kwargs)
>>   File 
>> 

Re: not a valid UUID.

2020-05-03 Thread Nomeh Uchenna Gabriel
On Sunday, May 3, 2020 at 9:10:28 AM UTC+1, Benedict Uwazie wrote:
> Still facing the same issue
> 
> On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze  wrote:
> default=cast_trans
> cast_trans = int(pass_trans)
> 
> UUID is string not int
> 
> 
> On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie  wrote:
> 
> 
> 
> On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie  wrote:
> 
> I added a field called transaction_id in my models.py I want that field to be 
> used to track every transaction on my "DuesLevy" model I imported uuid to 
> this to happen, but each time I migrate I get this error.
> How do i prevent this error from occurring each time I migrate (python 
> manage.py migrate) File 
> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>  line 2344, in to_python
> params={'value': value},
> django.core.exceptions.ValidationError: ["'13615773708697' is not a valid 
> UUID."]
> 
> 
> my models.py
> 
> 
> trans_id = uuid.uuid4()
> trans_str = trans_id.int
> pass_trans = str(trans_str)[:12]
> cast_trans = int(pass_trans)
> class DuesLevy(models.Model):
> class_of_dues = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.CLASS_OF_DUES, blank=True)
> payment_circle = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_CIRCLE)
> payment_option = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_OPTION)
> amount = models.DecimalField(max_digits=8, decimal_places=2)
> transaction_id = models.UUIDField(max_length=100, unique=True, null=True, 
> blank=True, editable=False, default=cast_trans)
> payment_channel = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_CHANNEL_TYPE)
> payment_date = models.DateField()
> date_recorded = models.DateTimeField(auto_now_add=True)
> user = models.ForeignKey(settings.AUTH_USER_MODEL, 
> on_delete=models.CASCADE)
> description = models.TextField(blank=True, null=True)
> 
> def __str__(self):
> return self.amount
> 
>   
> def get_absolute_url(self):
> return reverse('backend:detail_dues', kwargs={'pk': self.id})
> 
> 
> 
> 
> 
> 
> -- 
> 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/4a1d77cc-d1b8-4bd4-84cd-cd78e6d2eb76%40googlegroups.com.



On Sunday, May 3, 2020 at 9:10:28 AM UTC+1, Benedict Uwazie wrote:
> Still facing the same issue
> 
> On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze  wrote:
> default=cast_trans
> cast_trans = int(pass_trans)
> 
> UUID is string not int
> 
> 
> On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie  wrote:
> 
> 
> 
> On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie  wrote:
> 
> I added a field called transaction_id in my models.py I want that field to be 
> used to track every transaction on my "DuesLevy" model I imported uuid to 
> this to happen, but each time I migrate I get this error.
> How do i prevent this error from occurring each time I migrate (python 
> manage.py migrate) File 
> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>  line 2344, in to_python
> params={'value': value},
> django.core.exceptions.ValidationError: ["'13615773708697' is not a valid 
> UUID."]
> 
> 
> my models.py
> 
> 
> trans_id = uuid.uuid4()
> trans_str = trans_id.int
> pass_trans = str(trans_str)[:12]
> cast_trans = int(pass_trans)
> class DuesLevy(models.Model):
> class_of_dues = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.CLASS_OF_DUES, blank=True)
> payment_circle = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_CIRCLE)
> payment_option = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_OPTION)
> amount = models.DecimalField(max_digits=8, decimal_places=2)
> transaction_id = models.UUIDField(max_length=100, unique=True, null=True, 
> blank=True, editable=False, default=cast_trans)
> payment_channel = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_CHANNEL_TYPE)
> payment_date = models.DateField()
> date_recorded = models.DateTimeField(auto_now_add=True)
> user = models.ForeignKey(settings.AUTH_USER_MODEL, 
> on_delete=models.CASCADE)
> description = models.TextField(blank=True, null=True)
> 
> def __str__(self):
> return self.amount
> 
>   
> def get_absolute_url(self):
> return reverse('backend:detail_dues', kwargs={'pk': self.id})
> 
> 
> 
> 
> 
> 
> -- 
> 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> 
> To unsubscribe from this group and 

Re: How to refer to another translation in a translation?

2020-05-03 Thread Andréas Kühne
Once again - you are doing a too simple example - translating from english
to english isn't really a valid example. I understand that you would like
to make it simpler - but the thing is that you never can know where the
word is set in OTHER languages than from english to english. The reason I
brought up this is because in various languages the wording will change -
therefore your translation MIGHT work in english -> english but it would
break other languages.

Also once more - the .po file format is NOT python specific - it is used by
the gettext library and using python in there will simply not work. The
gettext standard is used by many other languages as well (even wordpress
uses it for translations).

If you really want to go down that route - you would need to write your own
translation library - extract all of the translations, create an
intermediate format for handling the words that are used in several places
- use that file for translation, then create a new .po file from the
results of that. And THEN run compilemessages.

Translations aren't simple - regardless of which way you do it

Regards,

Andréas


Den lör 2 maj 2020 kl 21:07 skrev gqq nbig :

> I don't get why you are talking about this.
>
> I understand the words may change order in another language, but I'm not
> talking about ordering.
>
>
> {% trans 'color' %}
> {% trans 'color has various emotional effects.' %}
> {% trans 'Red color makes people feel angry.' %}
> {% trans 'Blue color makes people feel said.' %}
>
> Now I translate this America English to British English.
>
>
> msgid "color"
> msgstr "colour"
>
> Since I already translated color to colour, I want to refer this
> translation in other translations.
>
> msgid "color has various emotional effects."
> msgstr "{{ refer to the translated text of color }} has various emotional
> effects."
>
> msgid "Red color makes people feel angry."
> msgstr "Red {{ refer to the translated text of color }}  makes people feel
> angry."
>
> In this msgstr, is it possible to refer to the string colour?
>
> In this way, in case later my boss says color should be translated to tint
> in en-UK, I only need to change one place.
>
>
>
> 在 2020年5月2日星期六 UTC-7上午11:44:41,Andréas Kühne写道:
>>
>> Hi,
>>
>> Your idea isn't that good. The problem is the following:
>>
>> _("My name is {name}").format(name='Andréas')
>>
>> This is a translation in a python context. So say that that translation
>> gets translated into another language, where the name should come first:
>>
>> msgid "My name is {name}"
>> msgstr "{name} other translated text"
>>
>> You never know what order the translations will be coming in, in various
>> languages. So you should actually AVOID DRY in translations The more
>> you can pinpoint a translatable string the better.
>>
>> Also - the .po files that are used for translation are a format that is
>> specified OUTSIDE of python and django anyway :)
>>
>> Regards,
>>
>> Andréas
>>
>>
>> Den lör 2 maj 2020 kl 00:39 skrev gqq nbig :
>>
>>> msgid "Tree free"
>>> msgstr "aa"
>>>
>>> msgid "True free is good"
>>> msgstr "aa is good"
>>>
>>> This po file has a key "Tree free", which I translated to "aa". There is
>>> another key "True free is good", which should be translated to "aa is
>>> good."
>>>
>>> Considering the Don't Repeat Yourself rule, can I refer the translation
>>> of "Tree free" in "True free is good".
>>>
>>> I'm looking for a syntax or sort of things that is like
>>>
>>>
>>> msgid "True free is good"
>>> msgstr "{% trans 'Tree free' %} is good"
>>>
>>>
>>>
>>> Can I refer to another translation in a translation? I'm fine with
>>> extending an internal class, how should I do it?
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/a5a0b03a-eb4c-4699-ac69-5c1db9320805%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4732ad74-0266-4c0c-b938-33ea40c15627%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on 

Watch "URL Implementation For RSS FEED in django| python | part 3" on YouTube

2020-05-03 Thread Anonymous Patel
https://youtu.be/oCSMWSp1_UI

Its a series or playlist where they provide how to create rss feed in
django website

Raj Patel

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF_9CivFK3Zz4bHfjcLCr5L4icuTpF%2BWngY%3D5RwoduEiBC-pHw%40mail.gmail.com.


Re: not a valid UUID.

2020-05-03 Thread Benedict Uwazie
Still facing the same issue

On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze wrote:
>
> default=cast_trans cast_trans = int(pass_trans)
> UUID is string not int
>
> On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie  > wrote:
>
>>
>>
>> On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie wrote:
>>>
>>> I added a field called transaction_id in my models.py I want that field 
>>> to be used to track every transaction on my "DuesLevy" model I imported 
>>> uuid 
>>> to this to happen, but each time I migrate I get this error.
>>> How do i prevent this error from occurring each time I migrate (python 
>>> manage.py migrate) File 
>>> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>>>  
>>> line 2344, in to_python
>>> params={'value': value},
>>> django.core.exceptions.ValidationError: ["'13615773708697' is not a 
>>> valid UUID."]
>>>
>>> *my models.py*
>>> trans_id = uuid.uuid4()
>>> trans_str = trans_id.int
>>> pass_trans = str(trans_str)[:12]
>>> cast_trans = int(pass_trans)
>>> class DuesLevy(models.Model):
>>> class_of_dues = models.CharField(max_length=30, default
>>> =options.CHOOSE, choices=options.CLASS_OF_DUES, blank=True)
>>> payment_circle = models.CharField(max_length=30, default
>>> =options.CHOOSE, choices=options.PAYMENT_CIRCLE)
>>> payment_option = models.CharField(max_length=30, default
>>> =options.CHOOSE, choices=options.PAYMENT_OPTION)
>>> amount = models.DecimalField(max_digits=8, decimal_places=2)
>>> transaction_id = models.UUIDField(max_length=100, unique=True, null=
>>> True, blank=True, editable=False, default=cast_trans)
>>> payment_channel = models.CharField(max_length=30, default
>>> =options.CHOOSE, choices=options.PAYMENT_CHANNEL_TYPE)
>>> payment_date = models.DateField()
>>> date_recorded = models.DateTimeField(auto_now_add=True)
>>> user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete
>>> =models.CASCADE)
>>> description = models.TextField(blank=True, null=True)
>>>
>>> def __str__(self):
>>> return self.amount
>>> 
>>>   
>>> def get_absolute_url(self):
>>> return reverse('backend:detail_dues', kwargs={'pk': self.id})
>>>
>>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/4a1d77cc-d1b8-4bd4-84cd-cd78e6d2eb76%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56e9691b-bb0f-4d27-8f97-def14e34217d%40googlegroups.com.


Re: Making Serial number

2020-05-03 Thread Benedict Uwazie
Is your table row is inside a loop? If it is use {{ forloop.counter }}

On Sunday, 3 May 2020 04:32:38 UTC+1, Kushal Neupane wrote:
>
> Dear Sir, i learned and used from 
> https://docs.djangoproject.com/en/3.0/ref/templates/builtins/#linenumbers 
> 
>  
> site. But, how to make dynamic serial number? Thank you.
>
> [image: image.png]
> [image: image.png]
>
>
> On Sun, May 3, 2020 at 6:28 AM Benedict Uwazie  > wrote:
>
>> Inside your loop pass in forloop.counter like this {{ forloop.counter }} 
>> checkout this link 
>> https://techstream.org/Bits/Loop-Counter-in-Django-View
>>
>> On Saturday, 2 May 2020 18:48:09 UTC+1, Kushal Neupane wrote:
>>>
>>> Can you give one example sir? 
>>>
>>> On Sat, May 2, 2020, 23:30 victor awakan  wrote:
>>>
 Try html ordered list with your for loop. Like this 

 On Sat 2. May 2020 at 20.38, Kushal Neupane  wrote:

> Not primary key to use here.
> There might be different data.
> I am trying to do serial numbers as total numbers in the list. Thank 
> you 
>
> On Sat, May 2, 2020, 23:20 Jorge Gimeno  wrote:
>
>>
>>
>> On Sat, May 2, 2020 at 9:03 AM Kushal Neupane  
>> wrote:
>>
>>> How to make Serail Number 1, 2, 3 and respective in template? Help 
>>> me. 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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/3842baeb-b054-482a-b127-ae5c160493ca%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>
>> Models in Python have an autoincrementing primary key (unless you 
>> have turned that off).  See 
>> https://docs.djangoproject.com/en/3.0/topics/db/models/#automatic-primary-key-fields
>>
>> -Jorge
>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CANfN%3DK-HEni_1DQL7CKrE3nWtu%2BR1WgKmaAoMpPjiDsUd%3Daq6w%40mail.gmail.com
>>  
>> 
>> .
>>
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAFWyajUO4aw9qdb-zx1j_DYbFMDS2WrTzs8zVd0_tB3xYjNNaw%40mail.gmail.com
>  
> 
> .
>
 -- 
 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 view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/CAAipwd9H-aJjA6aFEcj0WWonTDyJ%2B3d42dSCcT0-8z6t1k1%2BUw%40mail.gmail.com
  
 
 .

>>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/5b6a83c8-2056-4cd2-ad7c-e0a070bb04fe%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a8c55f59-c35c-4395-ad91-90cfdfd35f1e%40googlegroups.com.


Re: sphinx inside

2020-05-03 Thread Kai Kobschätzki
thanks for your response!

Greetings

bengoshi


On 5/2/20 12:46 AM, Motaz Hejaze wrote:
> Inspect the generated sphinx html , load the static using django
>
> On Fri, 1 May 2020, 11:51 pm Michael Rohan,  > wrote:
>
> Hi,
>
> I believe it's probably easiest to simply create the Sphinx html
> files in one of the static directories (probably should add to the
> top level one if you have one, or one of the apps if the docs are
> app specific) and just let the static file handling serve them. 
> You could use whitenoise to have Django serve them (if you want to
> go that route).
>
> Take care,
> Michael.
>
> On Friday, May 1, 2020 at 1:02:59 PM UTC-7, bengoshi wrote:
>
> I tried a
>
> path('docs/',
> TemplateView.as_view(template_name="docs/html/index.html"))
>
> then I can see the index.html but without css and no link works..
>
> Greetings
>
> bengoshi
>
> On 5/1/20 4:25 PM, Motaz Hejaze wrote:
>> Make a view that returns a template only , and give it a url
>>
>> On Fri, 1 May 2020, 10:09 am Kai Kobschätzki,
>>  wrote:
>>
>> Hi Amit,
>>
>> thanks for your response. But in this way, I can't use
>> the sphinx templates, the links are not correct and after
>> every new make html (or using sphinx-autobuild) I have to
>> copy the changed or new files. Are there no more likable way?
>>
>> Greetings
>>
>> bengoshi
>>
>> On 5/1/20 1:53 AM, Amit Gupta wrote:
>>> Hii 
>>> If u want to just add your file in your django project u
>>> can probably copy and paste the file in your project
>>> file and after that you can successfully use your file
>>> in the project by just writing the name of  your file
>>> with correct extension
>>>
>>> On Fri, 1 May, 2020, 1:29 AM Kai Kobschätzki,
>>>  wrote:
>>>
>>> Hi,
>>>
>>> I installed sphinx and I get an documentation in
>>> project_main/docs/_build/html, starting with
>>> html/index.html. In so far
>>> - fine.
>>>
>>> Now I want to present this documents inside my
>>> project so I can see in
>>> the nav-bar a "doc" where I can see them. But I have
>>> no idea how to
>>> start it. I tried it with a simple function in a
>>> view inside an app, but
>>> then I need a symbolic-link for getting the
>>> index.html, but then I can't
>>> get the rest of the documentation.
>>>
>>> I tried to google it but I only find tutorials for
>>> using sphinx to make
>>> a documentation for the django-project but I didn't
>>> find a tip how I can
>>> realize it.
>>>
>>> Could anyone give a kick-off for it or a link for a
>>> tutorial? Perhaps I
>>> have only the wrong keywords..
>>>
>>> Greetings
>>>
>>> bengoshi
>>>
>>>
>>>
>>> -- 
>>> 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 view this discussion on the web visit
>>> 
>>> https://groups.google.com/d/msgid/django-users/17689333-b06c-1dfc-1f18-341689914c42%40gmail.com.
>>>
>>> -- 
>>> 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 view this discussion on the web visit
>>> 
>>> https://groups.google.com/d/msgid/django-users/CAGCPjY-tNBKxj%3Dk-e9ew_6DtySK%2BDPE1QJyyMsXi%2Bjt4f-qA4g%40mail.gmail.com
>>> 
>>> .
>> -- 
>> 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 view this discussion on the web visit
>> 
>> https://groups.google.com/d/msgid/django-users/6e32e790-46bd-bb1b-24a2-3e765f0a273a%40gmail.com
>> 
>> 

Hey django developers, I got small issue that is hoow to specify the template_root but my loader is already specify the temppath" django.template.loaders.filesystem.Loader: C:\Users\Admin\projects\tel

2020-05-03 Thread yashwanth balanagu
from django.shortcuts import render,redirect
from .models import upload
import zipfile as ZipFile
import os, tempfile
from django.forms import modelformset_factory
from .forms import uploadForm
from rest_framework.views import APIView
from .serializers import *
from rest_framework.response import Response 
from rest_framework import viewsets
from rest_framework import status
import zipfile
from django.views import View 
from .import serializers
from file.models import upload
from .serializers import uploadSerializers
import os 
from zipfile import ZIP_DEFLATED
from django_zipfile import TemplateZipFile
from django.shortcuts import get_list_or_404, get_object_or_404
from django.http import HttpResponse
os.chdir("C:/Users/Admin/Desktop")



def home(request):
if request.method=="POST":
user=request.POST['user'];
image=request.FILES['image'];
upload.objects.create(user=user,image=image)
files=upload.objects.all();
return redirect('foundation')
else:
return render(request,'file.html')

def foundation(request):
files=upload.objects.all();
return render(request,'foundation.html',{'files':files})

class download(APIView):

def get(self,request,id):
obj = get_object_or_404(upload, pk=id)
context = {
'object': obj
}
response = HttpResponse(content_type='application/octet-stream')
response['Content-Disposition'] = 'attachment; filename=myfile.zip'

container = TemplateZipFile(response, mode='w'
, compression=ZIP_DEFLATED, template_root= '' ) #How to specify temp root

container.write_template('file.html', context=context)
 
container.close()
return response


class datalist(APIView):
def get(self,request):
datas=upload.objects.all()
serializer = uploadSerializers(datas,many=True)
return Response(serializer.data)

def post(self,request):
serializer=uploadSerializers(data=request.data)
if serializer.is_valid():
serializer.save()
return Response(serializer.data)
return Response(serializer.errors)

def delete(self,request):
serializer=upload.objects.all()
serializer.delete()
return Response(status=status.HTTP_204_NO_CONTENT)


class datadetail(APIView):
def get(self,request,id):
model=upload.objects.get(id=id)
serializer=uploadSerializers(model)
return Response(serializer.data)

def delete(self,request,id):
serializer=upload.objects.get(id=id)
serializer.delete()
return Response(status=status.HTTP_204_NO_CONTENT)








-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d5499549-4306-4356-88d3-16ca1899ff43%40googlegroups.com.