Beginner problem linking pages from homepage?
Missing something basic here even after scouring web and running thru online tut a few times. Started a project 'mysite' and added twitter bootstrap then created a static homepage "index.html' to act as a simple launchpad to other more information & feature laden pages. Used direct_to_template to access the first page and it renders fine under the development server and a virtualenv (the latter is in the path). The homepage has a number of hrefs to the other pages which I filled in with './foo1', './foo2', etc. Using the hello function placed in ~/.../mysite/mysite/views.py, I've tried to branch off the main page as such in urls.py (goal is /homepage/foo1). *Note the extra code required in the file isn't represented here. from mysite.views import hello ... urlpatterns = patterns('', url(r'^foo1$', hello), url(r'^foo2$', hello), url(r'^foo3$', hello), url(r'^foo4$', hello), ) have also tried: urlpatterns = patterns('homepage', url(r'^foo1$', hello), url(r'^foo2$', hello), url(r'^foo3$', hello), url(r'^foo4$', hello), ) This causes the site to break with a 404 error even though I think I am supplying a correct regex and a toy function. I suspect there is something with the mysite views.py not being found but not sure. I have tried to more explicitly reference the views.py file with mysite.views.py trials. I am not even sure if philosophically this is considered a good practice of django. Thanks in advance for your assistance. V. -- 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/-/ojFywQSzpYsJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Beginner problem linking pages from homepage?
Thank you for the timely advice. Before I move my "base/homepage" site to its own app dir, thought I would give it another pass using your changes. Verified 'mysite.urls' in settings.py, added 'mysite' to the urlpatterns arg and put quotes around the hello func. I have had debugging from the outset of installation. views.py in the mysite/mysite dir is simply: def hello(request): return HttpResponse('Hello World!') The 404 error which comes up is: Page not found (404) Request Method: GET Request URL: http://192.168.1.126:8000/homepage/foo1 Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: 1. ^foo1$ 2. ^foo2$ 3. ^foo3$ 4. ^foo4$ The current URL, homepage/foo1, didn't match any of these. You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page. Could be a permissions thing or some subtle backslashes nuance I haven't picked up on yet? Thanks again. V. On Saturday, September 22, 2012 7:39:36 PM UTC-5, Sam Lai wrote: > > > > I just created a toy project with that urls.py and it worked fine. > > > I am not even sure if philosophically this is considered a good practice > of > > django. Thanks in advance for your assistance. V. > > Generally you would not create a views.py in your project directory > (mysite/mysite is your project directory). You would usually create an > app (mysite/manage.py startapp appname), create your views, app-level > URLs, models etc. in there, and then reference them in your project > urls.py by including your app's urls.py. > > Also, generally you would reference the view using a string, instead > of the actual view function itself. This saves you from having to > import every view, and avoid clashes in larger projects where you may > have view functions with the same name in different apps. In the > second urls.py you posted, the first parameter to patterns, where you > have 'homepage' specified, is used to shorten these view function > strings - that parameter is appended to your url definitions, i.e. you > could use the following urls.py instead - > > urlpatterns = patterns('mysite', >url(r'^foo1$', 'hello'), >url(r'^foo2$', 'hello'), >url(r'^foo3$', 'hello'), >url(r'^foo4$', 'hello'), > ) > > ... and Django will append 'mysite' to all the view function strings, > turning them into 'mysite.hello'. See > https://docs.djangoproject.com/en/dev/topics/http/urls/#the-view-prefix > > > > > > > -- > > 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/-/ojFywQSzpYsJ. > > To post to this group, send email to > > django...@googlegroups.com. > > > To unsubscribe from this group, send email to > > django-users...@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 view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/_y5eEwalYc8J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Beginner problem linking pages from homepage?
Addendum: the views.py also has the required 'from django.foo import" lines naturally. On Sunday, September 23, 2012 2:47:39 PM UTC-5, Vincent Fulco wrote: > > Thank you for the timely advice. Before I move my "base/homepage" site to > its own app dir, thought I would give it another pass using your changes. > Verified 'mysite.urls' in settings.py, added 'mysite' to the urlpatterns > arg and put quotes around the hello func. I have had debugging from the > outset of installation. views.py in the mysite/mysite dir is simply: > > def hello(request): > return HttpResponse('Hello World!') > > The 404 error which comes up is: > > Page not found (404) Request Method: GET Request URL: > http://192.168.1.126:8000/homepage/foo1 > > Using the URLconf defined in mysite.urls, Django tried these URL > patterns, in this order: > >1. ^foo1$ >2. ^foo2$ >3. ^foo3$ >4. ^foo4$ > > The current URL, homepage/foo1, didn't match any of these. > > You're seeing this error because you have DEBUG = True in your Django > settings file. Change that to False, and Django will display a standard > 404 page. Could be a permissions thing or some subtle backslashes nuance I > haven't picked up on yet? > Thanks again. V. > > > On Saturday, September 22, 2012 7:39:36 PM UTC-5, Sam Lai wrote: >> >> >> >> I just created a toy project with that urls.py and it worked fine. >> >> > I am not even sure if philosophically this is considered a good >> practice of >> > django. Thanks in advance for your assistance. V. >> >> Generally you would not create a views.py in your project directory >> (mysite/mysite is your project directory). You would usually create an >> app (mysite/manage.py startapp appname), create your views, app-level >> URLs, models etc. in there, and then reference them in your project >> urls.py by including your app's urls.py. >> >> Also, generally you would reference the view using a string, instead >> of the actual view function itself. This saves you from having to >> import every view, and avoid clashes in larger projects where you may >> have view functions with the same name in different apps. In the >> second urls.py you posted, the first parameter to patterns, where you >> have 'homepage' specified, is used to shorten these view function >> strings - that parameter is appended to your url definitions, i.e. you >> could use the following urls.py instead - >> >> urlpatterns = patterns('mysite', >>url(r'^foo1$', 'hello'), >>url(r'^foo2$', 'hello'), >>url(r'^foo3$', 'hello'), >>url(r'^foo4$', 'hello'), >> ) >> >> ... and Django will append 'mysite' to all the view function strings, >> turning them into 'mysite.hello'. See >> https://docs.djangoproject.com/en/dev/topics/http/urls/#the-view-prefix >> >> > >> > >> > -- >> > 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/-/ojFywQSzpYsJ. >> > To post to this group, send email to django...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > django-users...@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 view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Nn11fTWKCMkJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Beginner problem linking pages from homepage?
Thanks all. Just getting up to speed on regex, need to re-read some chapters. Changing these to the suggested above, fixing the mismatched from "mysite.views import hello" by importing * in the urls.py and removing the quotes around the func got me to my targeted basic site. Best, V. On Sunday, September 23, 2012 4:54:46 PM UTC-5, JirkaV wrote: > > Hi Vincent, > > Django is telling you what the problem is - none of strings in urls.py > matches the requested URL. All lines in your file say that the regular > expression fas nothing before the "foo" (the "^" character says that). > However the URL you are trying has "homepage/" before "foo". Hence it does > not match. > > You need to correct this before you can proceed furter. Either remove the > "homepage/" from your request (may be in a link on your first page) or > change the urls.py accordingly. > > HTH > > Jirka > -- > *From: * Vincent Fulco > > *Sender: * django...@googlegroups.com > *Date: *Sun, 23 Sep 2012 12:47:39 -0700 (PDT) > *To: *> > *ReplyTo: * django...@googlegroups.com > *Subject: *Re: Beginner problem linking pages from homepage? > > Thank you for the timely advice. Before I move my "base/homepage" site to > its own app dir, thought I would give it another pass using your changes. > Verified 'mysite.urls' in settings.py, added 'mysite' to the urlpatterns > arg and put quotes around the hello func. I have had debugging from the > outset of installation. views.py in the mysite/mysite dir is simply: > > def hello(request): > return HttpResponse('Hello World!') > > The 404 error which comes up is: > > Page not found (404) Request Method: GET Request URL: > http://192.168.1.126:8000/homepage/foo1 > > Using the URLconf defined in mysite.urls, Django tried these URL > patterns, in this order: > >1. ^foo1$ >2. ^foo2$ >3. ^foo3$ >4. ^foo4$ > > The current URL, homepage/foo1, didn't match any of these. > > You're seeing this error because you have DEBUG = True in your Django > settings file. Change that to False, and Django will display a standard > 404 page. Could be a permissions thing or some subtle backslashes nuance I > haven't picked up on yet? > Thanks again. V. > > > On Saturday, September 22, 2012 7:39:36 PM UTC-5, Sam Lai wrote: >> >> >> >> I just created a toy project with that urls.py and it worked fine. >> >> > I am not even sure if philosophically this is considered a good >> practice of >> > django. Thanks in advance for your assistance. V. >> >> Generally you would not create a views.py in your project directory >> (mysite/mysite is your project directory). You would usually create an >> app (mysite/manage.py startapp appname), create your views, app-level >> URLs, models etc. in there, and then reference them in your project >> urls.py by including your app's urls.py. >> >> Also, generally you would reference the view using a string, instead >> of the actual view function itself. This saves you from having to >> import every view, and avoid clashes in larger projects where you may >> have view functions with the same name in different apps. In the >> second urls.py you posted, the first parameter to patterns, where you >> have 'homepage' specified, is used to shorten these view function >> strings - that parameter is appended to your url definitions, i.e. you >> could use the following urls.py instead - >> >> urlpatterns = patterns('mysite', >>url(r'^foo1$', 'hello'), >>url(r'^foo2$', 'hello'), >>url(r'^foo3$', 'hello'), >>url(r'^foo4$', 'hello'), >> ) >> >> ... and Django will append 'mysite' to all the view function strings, >> turning them into 'mysite.hello'. See >> https://docs.djangoproject.com/en/dev/topics/http/urls/#the-view-prefix >> >> > >> > >> > -- >> > 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/-/ojFywQSzpYsJ. >> > To post to this group, send email to django...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > django-users...@googlegroups.com. >> &
django<-->twitter bootstrap philosophy
Been thru the Django manual, bootstrap website instructions and other resources a few times so have working understanding of MVC structure. However, the incorporation of bootstrap throwing me off a little. Working on a ecommerce idea, for now plan is to create homepage (using bootstrap) as a launchpad to other pages (using bootstrap) providing services for two different target audiences (producers and consumers of service). Once at the second site(?), this is where the MVC comes in for login/registration/EULA agreements/data io, etc. Is bootstrap considered to be substitute template for parts of the website then the django templating system takes up the rest? Any trailheads for these concepts would be much appreciated. TIA, V. -- 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/-/hRg6yZPq6QkJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django<-->twitter bootstrap philosophy
Yes, thanks. Templating remains the last piece of the puzzle I have yet to really work on and it wasn't clear how different it was from a framework. Appreciate your explanation. V. On Tuesday, September 25, 2012 11:40:36 AM UTC-5, azizmb.in wrote: > > I think you have confused things a little. Bootstrap is a CSS framework, > and makes it easy to *style* your pages, and includes a few javascript > libraries. Django on the other hand, is an MVC as you mentioned. Bootstrap > operates completely in the browser and handles only styling, and not > templating. You can definitely include the bootstrap library in your > templates, and use its classes to style your pages. > Example<https://github.com/azizmb/mingus-bootstrap-theme/blob/master/mingus_bootstrap_theme/templates/base.html> > . > > I hope this clears your confusion. > > On Tue, Sep 25, 2012 at 8:58 PM, Vincent Fulco > > wrote: > >> Been thru the Django manual, bootstrap website instructions and other >> resources a few times so have working understanding of MVC structure. >> However, the incorporation of bootstrap throwing me off a little. Working >> on a ecommerce idea, for now plan is to create homepage (using bootstrap) >> as a launchpad to other pages (using bootstrap) providing services for two >> different target audiences (producers and consumers of service). Once at >> the second site(?), this is where the MVC comes in for >> login/registration/EULA agreements/data io, etc. >> >> Is bootstrap considered to be substitute template for parts of the >> website then the django templating system takes up the rest? >> >> Any trailheads for these concepts would be much appreciated. >> >> TIA, V. >> >> -- >> 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/-/hRg6yZPq6QkJ. >> To post to this group, send email to django...@googlegroups.com >> . >> To unsubscribe from this group, send email to >> django-users...@googlegroups.com . >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > > > -- > - Aziz M. Bookwala > > Website <http://azizmb.in/> | Twitter <https://twitter.com/azizbookwala> > | Github <http://github.com/azizmb> > > -- 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/-/np4Die6O-AwJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How to run cdn link in a local setup without screwed up hyperlink?
Attempting to use bootstrapcdn.com in a local bootstrap template on a VM (with 2nd IP address to outside world) before pushing to heroku. Standard code in the head: http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css"; rel="stylesheet"> Static urls ref in other lines works fine--> Django base.py seems to be set up correctly but I get a mangled hyperlink and #404 error: /website/http//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js HTTP/1.1" 404 2915 TIA, V. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Help implement CSS into Django!!!!
Running a dev server, is the following required or not--> "manage.py collectstatic"? The official docs would indicate no and there is too much mis-information floating around so it is hard to verify one way or the other for a noob. Django 1.4 would appear to be able to find static files in dev mode and only in an external production setup is the command required. TIA, V. On Saturday, January 5, 2013 8:50:34 PM UTC-6, carl...@vanoc.net wrote: > > On Jan 5, 2013, at 9:12 PM, Czaro > > wrote: > > I've been trying to get my CSS to work with my python powered site forever > but I have no luck. I read the djangobook and a massive load of other > resources but they all say a different thing and nothing worked for me. I > would appreciate a few helpful steps on how to get my CSS to work. > Some details: > I;m in development mode. > I'm using runserver and when i run it I only see the HTML and not the CSS. > I'm also not sure if my CSS files need to be hosted on a separate server. > Any help will be greatly appreciated. > Thanks!!1 > > -- > 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/-/WpOUKKUuRD4J. > To post to this group, send email to django...@googlegroups.com > . > To unsubscribe from this group, send email to > django-users...@googlegroups.com . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > Have you set STATICFILES_DIRS, STATICFILES_ROOT, and STATIC_URL in your > settings.py and run "manage.py collectstatic"? You should be putting your > files in the directory(s) you have in STATICFILES_DIRS and then running > manage.py collectstatic. In development, runserver will serve your static > files but in production django will not handle those URLs and you will need > to either host them elsewhere or set up your web server to serve them. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to run cdn link in a local setup without screwed up hyperlink?
[SOLVED] Oddly, copied right from an online resource and colon was missing in web address, accesses external site correctly now. On Saturday, April 13, 2013 9:37:07 AM UTC-5, Vincent Fulco wrote: > > Attempting to use bootstrapcdn.com in a local bootstrap template on a VM > (with 2nd IP address to outside world) before pushing to heroku. Standard > code in the head: > > http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css"; > > rel="stylesheet"> > > > > Static urls ref in other lines works fine--> href="{{STATIC_URL}}css/custom.css" rel="stylesheet"> > > Django base.py seems to be set up correctly but I get a mangled hyperlink > and #404 error: > > /website/http// > netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.jsHTTP/1.1" > 404 2915 > > > TIA, V. > > > > > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Simple Static Content Site on Heroku?
Fairly new to the framework and have been reading a ton of material. While I have found a couple of great git repos using Bootstrap with Django, I haven't found too many examples of dead simple sites other than some single page blogs. I am working on an informational site with at most 5 pages and potentially a blog down the road for a customer (thinking S3, compressor, boto, etc. usage within). Do I even need to incorporate the PostgreSQL RDBMS at this juncture or should I set it up for future proofing purposes? Django is most likely too feature packed for such a rudimentary project, yet using it is fulfilling a secondary role of giving me a learning stepping stone to a few more projects with greater complexity. So I am not looking for other tools to use, just some mention of what I can safely do at this point (elimination wise) and still have a robust, well designed, responsive offering. TIA, V. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Background pattern files on S3 not being found while hosted on Heroku
Verified S3 files are there and app on Heroku finds custom.css as other bits come thru correctly. Within body{} of custom.css have tried the following based on scouring the Net help sites (assume same for background:url and background-image:url): 1) url(img/backgrounds/foo.png) ref'ed to STATIC_URL in settings.py ("https://s3.amazonaws.com/foo_media/";) both with and w/o the quotes 2) url("{{STATIC_URL}}img/backgrounds/foo.png") hard coded both with and w/o the quotes 3) url("https://s3.amazonaws.com/foo_media/img/backgrounds/foo.png";) TIA, V. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Background pattern files on S3 not being found while hosted on Heroku
Should add running the normal django-storages, boto setup for serving static from S3. On Sunday, June 23, 2013 9:45:40 AM UTC-5, Vincent Fulco wrote: > > Verified S3 files are there and app on Heroku finds custom.css as other > bits come thru correctly. > > Within body{} of custom.css have tried the following based on scouring the > Net help sites (assume same for background:url and background-image:url): > > > 1) url(img/backgrounds/foo.png) > > ref'ed to STATIC_URL in settings.py ("https://s3.amazonaws.com/foo_media/";) > both with and w/o the quotes > > 2) url("{{STATIC_URL}}img/backgrounds/foo.png") > > hard coded both with and w/o the quotes > 3) url("https://s3.amazonaws.com/foo_media/img/backgrounds/foo.png";) > > TIA, V. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Background pattern files on S3 not being found while hosted on Heroku
retried #3 without quotes and link works now. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.