Re: NoReverseMatch at /home/ error

2023-04-23 Thread Parfait TOLEFO
Thank you for your help. I add name=‘home’ in the url and it is ok now .

On Sun, 23 Apr 2023 at 17:38 Sebastian Jung 
wrote:

> Hello,
>
> This can't be work with {% urls 'home' %} from another website. Pls writes
> /home in href...
>
> Regards
>
> Parfait TOLEFO  schrieb am So., 23. Apr. 2023,
> 18:21:
>
>> [image: error.png]Hello everyone, please, I have this error  *NoReverseMatch
>> at /home/ *when I want to put link to home page from other page.
>>
>> [image: VEW.png]
>> This is my views.py content
>>
>> [image: URL.png]
>>
>> This is my urls.py content.
>>
>>
>> Please help me. Thank you so much
>>
>> --
>> 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/aa768d6d-5348-4c8d-ab7a-37617309572cn%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/CAKGT9mxrWNoPSaEbVDoQ54ckztK8puuKLBcw%3DGX0%3DsASFypvGw%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/CAGHQqL1%3DqYiBgZTWWKDNSCQG40rLT7SHRMc%3DDm%3DG_1ddpMoiZA%40mail.gmail.com.


Re: Web portal by Django

2023-04-23 Thread Letlaka Tsotetsi
I agree with the other guys the tutorial is a great place to start  and
once you have a clear understanding of how Django functions then you can
start building on that knowledge.  As it's been mentioned your question is
too open ended. Maybe if it had more specifications to it we might be able
to offer some help.

On Tue, 11 Apr 2023 at 2:44 PM, Ananya Agrawal 
wrote:

> How to build a web portal for license information management by using
> django?
>
> --
> 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/0d9ea21f-c6be-4cb9-8ad6-f4f019974545n%40googlegroups.com
> 
> .
>
-- 
Letlaka Tsotetsi
071 038 1485
letlak...@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/CAMCgpdKxctGnsg3%2BXuVPpT1eJ9Nx6Nk8ydggFx%3DhvsWZju5tTA%40mail.gmail.com.


python manage.py commonds: AttributeError: 'PosixPath' object has no attribute 'startswith'

2023-04-23 Thread DL
Django 4.2
Python 3.10.10

# python manage.py run_cmdb_worker
Traceback (most recent call last):
  File "/usr/local/python/lib/python3.10/pkgutil.py", line 417, in 
get_importer
importer = sys.path_importer_cache[path_item]
KeyError: PosixPath('/www/cloudadmin')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/www/cloudadmin/manage.py", line 22, in 
main()
  File "/www/cloudadmin/manage.py", line 18, in main
execute_from_command_line(sys.argv)
  File 
"/opt/.pyvenv/lib/python3.10/site-packages/django/core/management/__init__.py", 
line 442, in execute_from_command_line
utility.execute()
  File 
"/opt/.pyvenv/lib/python3.10/site-packages/django/core/management/__init__.py", 
line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/opt/.pyvenv/lib/python3.10/site-packages/django/core/management/__init__.py", 
line 275, in fetch_command
klass = load_command_class(app_name, subcommand)
  File 
"/opt/.pyvenv/lib/python3.10/site-packages/django/core/management/__init__.py", 
line 48, in load_command_class
module = import_module("%s.management.commands.%s" % (app_name, name))
  File "/usr/local/python/lib/python3.10/importlib/__init__.py", line 126, 
in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1050, in _gcd_import
  File "", line 1027, in _find_and_load
  File "", line 1006, in 
_find_and_load_unlocked
  File "", line 688, in _load_unlocked
  File "", line 883, in exec_module
  File "", line 241, in 
_call_with_frames_removed
  File "/www/cloudadmin/apps/cmdb/management/commands/run_cmdb_worker.py", 
line 2, in 
from cmdb.scheduler import Scheduler
  File "/www/cloudadmin/apps/cmdb/scheduler.py", line 3, in 
from apscheduler.schedulers.background import BackgroundScheduler
  File "/opt/.pyvenv/lib/python3.10/site-packages/apscheduler/__init__.py", 
line 1, in 
from pkg_resources import get_distribution, DistributionNotFound
  File 
"/opt/.pyvenv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 
3260, in 
def _initialize_master_working_set():
  File 
"/opt/.pyvenv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 
3234, in _call_aside
f(*args, **kwargs)
  File 
"/opt/.pyvenv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 
3272, in _initialize_master_working_set
working_set = WorkingSet._build_master()
  File 
"/opt/.pyvenv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 
572, in _build_master
ws = cls()
  File 
"/opt/.pyvenv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 
565, in __init__
self.add_entry(entry)
  File 
"/opt/.pyvenv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 
621, in add_entry
for dist in find_distributions(entry, True):
  File 
"/opt/.pyvenv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 
1988, in find_distributions
importer = get_importer(path_item)
  File "/usr/local/python/lib/python3.10/pkgutil.py", line 421, in 
get_importer
importer = path_hook(path_item)
  File "", line 1632, in 
path_hook_for_FileFinder
  File "", line 1504, in __init__
  File "", line 182, in _path_isabs
AttributeError: 'PosixPath' object has no attribute 'startswith'

I must midify settings.py, change BASE_DIR, it can run
# BASE_DIR = Path(__file__).resolve().parent.parent 
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))


-- 
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/033f2f50-b073-4a97-9d66-6cc7f8a18049n%40googlegroups.com.


Re: Sequence order in django

2023-04-23 Thread Nitesh Solanki
Hi Pooja,

Can you please explain it a little bit like, suppose you are having 10 
tracks in a list and you select 5th, then what do you want while you are 
having two partitions?

first partition - 1st to 4th tracks (before the 5th track)
second partition - 6th to 10th tracks (after the 5th track)

On Monday, 3 April, 2023 at 4:16:29 pm UTC+5:30 Jason wrote:

> seems like what you're asking for is user-defined ordering, and I 
> implemented this for O'Reilly's playlists.
>
> https://begriffs.com/posts/2018-03-20-user-defined-order.html is a great 
> help for the data side.  
>
> On Monday, April 3, 2023 at 12:50:43 AM UTC-4 Pooja Kumari wrote:
>
>> Hi guys... I wanna know if there any build-in function in django to re 
>> order the sequence order... Let me explain I have a playlist where some 
>> tracks are saved now I want to change the sequence order of track and rest 
>> of track will reorder according to given track number. If I assign number 5 
>> to any track rest will automatically start from 1 to 4. Any idea how can I 
>> do that?
>>
>

-- 
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/05f14a1c-2fe2-48e0-9926-9b78f4adf568n%40googlegroups.com.


Re: Django urls error

2023-04-23 Thread Nitesh Solanki
myproject (main app)
myapp (additional app)

Code: myproject/urls.py

from django.contrib import admin
from django.urls import path, include

from .views import HomeView

urlpatterns = [
path('admin/', admin.site.urls),
path('', HomeView, name='home'), ### will refer to main app views.py. 
These routes are commonly written in main app only
path('hello/', include('myapp.urls')),
] -- 
Code: myproject/settings.py
# Application definition

INSTALLED_APPS = [
...
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp', ### added to inform the django project that we have installed 
a new app named 'myapp'
]

-- 
Code: myproject/views.py
### refers to all the common route associated to main app (myproject)
from django.http import HttpResponse

def HomeView(request):
return HttpResponse('Home page!')
-- 
Code: myapp/urls.py
### refers to all route which are associated with our new app 'myapp'. All 
routes declared here, can be accessed by adding a prefix '/hello/' ### 
because we have declared a word 'hello/' to refer 'myapp' in the 
'myproject/urls.py'
from django.urls import path
from .views import hello_delhi_capitals

urlpatterns = [
path('', hello_delhi_capitals, name='hello_delhi_capitals'),
]
-- 
Code: myapp/urls.py
### refers to all the common route associated to 'myapp' app 
from django.http import HttpResponse

def hello_delhi_capitals(request):
return HttpResponse('Hello Delhi Capitals!')
After running the project two urls will work here 
http://127.0.0.1:8000/
http://127.0.0.1:8000/hello/
On Sunday, 23 April, 2023 at 6:43:37 am UTC+5:30 ritik sahoo wrote:

> Exactly 
>
> On Tue, 18 Apr, 2023, 3:46 am Tarun Miri,  wrote:
>
>> You may not write any string on the urls.py of myapp/urls.py 
>> Ex path('',hello_delhi_capitals,name="hello_delhi_capitals"),
>>
>> On Sat, 15 Apr, 2023, 7:29 am Muhammad Juwaini Abdul Rahman, <
>> juw...@gmail.com> wrote:
>>
>>> In your urls.py you use '/hello' but in your browser you type '/home'.
>>>
>>> On Sat, 15 Apr 2023 at 06:07, lalit upadhyay  
>>> wrote:
>>>
 *I have copied my code here. Plz fix this error:*


 view.py
 from django.http import HttpResponse


 def hello_delhi_capitals(request):
 return HttpResponse('Hello Delhi Capitals!')



 myproject/urls.py

 from django.contrib import admin
 from django.urls import path, include

 urlpatterns = [
 path('admin/', admin.site.urls),
 path('hello/', include('myapp.urls')),
 ]



 myapp/urls.py



 from django.urls import path
 from .views import hello_delhi_capitals

 urlpatterns = [
 path('hello/', hello_delhi_capitals, name='hello_delhi_capitals'),
 ]

 -- 
 You received this message because you are subscribed to the Google 
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to django-users...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/b157258f-6697-4bd7-81c7-48e425b4a1edn%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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/CAFKhtoTQB506MC1OwxvHhT23R5kK-0uC5cxcDm3YS3Q6SYM-Pg%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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CA%2BznC8P5goz9Wzfreknw7vhpChMxjxb4P2jZOa%2BpP68%3D0r3FKA%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 

Re: Web portal by Django

2023-04-23 Thread Nitesh Solanki
Hi Ananya,
You can follow this - https://djangoforbeginners.com/introduction/

On Thursday, 13 April, 2023 at 7:13:05 pm UTC+5:30 Ryan Nowakowski wrote:

> I recommend starting from the tutorial. That'll give you some idea of what 
> Django is capable of. Then you can build your web portal after you 
> understand the basics.
>
>
> On April 11, 2023 4:21:12 AM CDT, Ananya Agrawal  
> wrote:
>>
>> How to build a web portal for license information management by using 
>> django? 
>>
>>

-- 
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/7531a555-4e45-4c0c-b8b3-4e62c5d8e42en%40googlegroups.com.