On Aug 31, 2012, at 8:44 AM, Amyth Arora <aroras.official@gmail.com> wrote:
Hey Mike,
I think i understand what you are trying to achieve now. You can basically name your urls and then call the url template tag in the templates with the url name as follows, this way you will not break any urls in your template if you simply move your app to a new location.
Example:
#zetawrite account urls
urlpatterns += patterns('zetawrite.views',
url(r'^zetawrite/account/signup/$', 'account_signup', name='account_signup'),
url(r'^zetawrite/account/profile/$', 'account_profile', name='account_profile'),
url(r'^zetawrite/account/settings/$', 'account_settings', name='account_settings'),
)
Then use the url template tag as follows:for an anchor tag like <a href="/account/profile">Profile</a>use <a href="{% url account_profile %}">Profile</a>Hope this helps.
On Fri, Aug 31, 2012 at 11:33 AM, Michael Thon <mike.thon@gmail.com> wrote:
>
> the root directlry of my domain is hosting wordpress, which I'm using to develop the landing pages:
> www.zetawrite.com (I know, it still needs a lot of work).
>
> The app itself will only be available to logged in users so I thought that the easiest way to deploy it would be to run it in a subdirectory of the main website. Now I'm trying to do my first deployment to a staging server.
>
> here's the project level urls.py:
>
> urlpatterns = patterns('',
> # Uncomment the admin/doc line below to enable admin documentation:
> url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
>
> # Uncomment the next line to enable the admin:
> url(r'^zetawrite/admin/', include(admin.site.urls)),
> url(r'^zetawrite/accounts/', include('registration.backends.default.urls')),
> url(r'zetawrite/', include('sieveapp.urls')),
>
> )
>
> Eventually, If the app gets traction, I'll want to have the wordpress landing pages and the django project running on separate servers, so I should figure out how I can move it without changing any urls...
>
>
> On Aug 31, 2012, at 7:45 AM, Amyth Arora <aroras.official@gmail.com> wrote:
>
> could you post the directory structure and your urls.py file. Thanks.
>
> On Fri, Aug 31, 2012 at 11:00 AM, Mike <mike.thon@gmail.com> wrote:
>>
>> Quick question: I changed my urls.py so I can run my project in a subdirectory and I broke all the urls in my templates. Should I be using {% url path.to.some_view v1 v2 %} in all my templates instead of hard coding the path?
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Django users" group.
>> To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/SV-wL8jMdCUJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>
>
>
> --
> Thanks & Regards
> ----------------------------
>
> Amyth [Admin - Techstricks]
> Email - aroras.official@gmail.com, admin@techstricks.com
> Twitter - @a_myth_________
> http://techstricks.com/
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
Thanks & Regards
----------------------------
Amyth [Admin - Techstricks]
Email - aroras.official@gmail.com, admin@techstricks.com
Twitter - @a_myth_________
http://techstricks.com/--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment