コード例 #1
0
ファイル: urls.py プロジェクト: MdStart/Tweetme
from django.contrib import admin

from django.conf import settings
from django.conf.urls.static import static

from accounts.views import UserRegisterView

from hashtags.api.views import TagTweetAPIView
from hashtags.views import HashTagView
from tweets.api.views import SearchTweetAPIView
from tweets.views import TweetListView
from .views import home, SearchView

urlpatterns = [
    url(r'^admin/', admin.site.urls), #admin/
    url(r'^$', TweetListView.as_view(), name='home'), #/
    url(r'^search/$', SearchView.as_view(), name='search'), #/
    url(r'^tags/(?P<hashtag>.*)/$', HashTagView.as_view(), name='hashtag'),
    url(r'^tweet/', include('tweets.urls', namespace='tweet')),
    url(r'^api/tags/(?P<hashtag>.*)/$', TagTweetAPIView.as_view(), name='tag-tweet-api'), 
    url(r'^api/search/$', SearchTweetAPIView.as_view(), name='search-api'), 
    url(r'^api/tweet/', include('tweets.api.urls', namespace='tweet-api')),
    url(r'^api/', include('accounts.api.urls', namespace='profiles-api')),
    url(r'^register/$', UserRegisterView.as_view(), name='register'), #/
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^', include('accounts.urls', namespace='profiles')),
]


if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL, document_root=settings.STATIC_ROOT))
コード例 #2
0
ファイル: urls.py プロジェクト: eniseirem/django_tweetme
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include

from django.conf import settings
from django.conf.urls.static import static

from tweets.views import TweetListView
from tweetme import views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', TweetListView.as_view(), name="home"),
    path('tweet/', include(('tweets.urls', "Tweet"), namespace='tweet')),
    path('api/tweet/', include(('tweets.api.urls', "Api"), namespace='tweet-api')),

]

if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL, document_root=settings.STATIC_ROOT))
コード例 #3
0
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin

from django.conf import settings
from django.conf.urls.static import static

from tweets.views import TweetListView
from .views import home

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', TweetListView.as_view(), name='home'),
    url(r'^tweet/', include('tweets.urls', namespace='tweet')),
    url(r'^api/tweet/', include('tweets.api.urls', namespace='tweet-api')),
]

if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL,
                           document_root=settings.STATIC_ROOT))
コード例 #4
0
from django.urls import path
from django.views.generic import RedirectView
from tweets.views import (
    TweetDetailView,
    TweetListView,
    TweetCreateView,
    TweetUpdateView,
    TweetDeleteView
)
app_name = 'tweet'

urlpatterns = [
    path('', RedirectView.as_view(url = "/")),
    path('search/', TweetListView.as_view(), name = 'list'),
    path('<int:pk>/', TweetDetailView.as_view(), name = 'detail'),
    path('create/', TweetCreateView.as_view(), name = 'create'),
    path('<int:pk>/update/', TweetUpdateView.as_view(), name = 'update'),
    path('<int:pk>/delete/', TweetDeleteView.as_view(), name = 'delete'),

]


コード例 #5
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from tweets.views import TweetListView
from .views import home

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', TweetListView.as_view(), name="home"),
    url(r'^tweet/', include('tweets.urls', namespace="tweet")),
    url(r'^api/tweet/', include('tweets.api.urls', namespace="tweet-api")),
]
if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL,
                           document_root=settings.STATIC_ROOT))
コード例 #6
0
ファイル: urls.py プロジェクト: richardhsieh18/djangoTweetme
"""
from django.contrib import admin
from django.conf.urls import url, include
from django.conf import settings
from django.conf.urls.static import static

from accounts.views import UserRegisterView
from hashtags.views import HashTagView
from hashtags.api.views import TagTweetAPIView
from tweets.api.views import SearchTweetAPIView
from tweets.views import TweetListView
from .views import home, SearchView

urlpatterns = [
    url(r"^admin/", admin.site.urls),
    url(r"^$", TweetListView.as_view(), name='home'),
    url(r"^search/$", SearchView.as_view(), name='search'),
    url(r"^tags/(?P<hashtag>.*)/$", HashTagView.as_view(), name='hashtag'),
    url(r"^tweet/", include('tweets.urls', namespace='tweet')),
    url(r"^api/tweet/", include('tweets.api.urls', namespace='tweet-api')),
    url(r"^api/tags/(?P<hashtag>.*)/$",
        TagTweetAPIView.as_view(),
        name='tag-tweet-api'),
    url(r"^api/search/$", SearchTweetAPIView.as_view(), name='search-api'),
    url(r"^api/", include('accounts.api.urls', namespace='profiles-api')),
    url(r"^register/$", UserRegisterView.as_view(), name='register'),
    url(r'^', include('django.contrib.auth.urls')),
    url(r"^", include('accounts.urls', namespace='profiles')),
]

if settings.DEBUG:
コード例 #7
0
from django.contrib import admin
from django.conf import settings
from django.contrib.staticfiles import views
from django.conf.urls.static import static
from acounts.views import UserRegisterView
from tweets.views import TweetListView
from hashtags.views import HashTagView
from hashtags.api.views import TagTweetAPIView
from tweets.api.views import SearchTweetAPIView
from .views import home, SearchView
# if i have alot of apps in my pro , i can make for every app ,
# its view file and its templates folder to organize the pro
##tweets here is the name of the app
urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', TweetListView.as_view(),
        name='home'),  # when press home title apear list 
    url(r'^search/$', SearchView.as_view(), name='search'),
    url(r'^tags/(?P<hashtag>.*)/$', HashTagView.as_view(), name='hashtag'),
    url(r'^tweet/', include('tweets.urls', namespace='tweet')),
    url(r'^api/tags/(?P<hashtag>.*)/$',
        TagTweetAPIView.as_view(),
        name='tag-tweet-api'),
    url(r'^api/search/$', SearchTweetAPIView.as_view(), name='search-api'),
    url(r'^api/tweet/', include('tweets.api.urls', namespace='tweet-api')),
    url(r'^api/', include('acounts.api.urls', namespace='profiles-api')),
    url(r'^register/$', UserRegisterView.as_view(), name='register'),
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^', include('acounts.urls', namespace='profiles')),
]
if settings.DEBUG:
コード例 #8
0
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import include

from .views import index
from tweets.views import TweetListView
from hashtags.views import HashTagView

urlpatterns = [
    path('', TweetListView.as_view(), name="index"),
    path('admin/', admin.site.urls),
    path('tags/<path:hashtag>/', HashTagView.as_view(), name="hashtag"),
    # path('profiles/', include('accounts.urls', namespace='profiles')),
    path('tweet/', include('tweets.urls', namespace='tweets')),
    path('api/tweet/', include('tweets.api.urls', namespace='tweets-api')),
    path('api/', include('accounts.api.urls', namespace='profiles-api')),
    path('', include('accounts.urls', namespace='profiles')),
]

if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL,
                           document_root=settings.STATIC_ROOT))