You are not logged in.

Change Language:

Freelancer? Consultant? Check out: WorkTrail - Time Tracking made easy
Profile for Annatar

Name Annatar
Email Address impachetatoru_de_caramele@yahoo.com
AvatarUsers avatar
Posts33
  • Re: getting 'NoneType' object is unsubscriptable errors
    Board » Django » Views
    i think that in your code you try to iterate through a list, but that list gets a None value.
    so, whenever you try to do something like
    for i in x:
      do_some_stuff()
    

    if x is None, then code will throw an exception, and this will be the case in your Django templates too. try checking how your list variable gets its value. and if you get the None value and it's ok, try replacing it with an empty list instead.

    --- Last Edited by Annatar at 2011-07-07 09:12:10 ---
  • Tools of the trade
    Board » General Category » General Discussion
    Hi guys, what are your weapons of choice when developing Django apps?
    When I first started, a couple of years ago, I was using primitive methods:
    • Notepad++ (do not underestimate its power, though) for casual quick editing
    • Komodo IDE for when I really needed syntax highlighting and code completion, usually when writing code from scratch; it also provides some cool HTML/XML features that came in handy

    Back then the Python IDEs didn't come with features for Django, you'd still have to run and build everything manually.
    Now we have more and more IDEs that are Django-aware and come bundled with many features useful for web development. So I started using:
    • PyCharm: lets you create Django projects, with the basic file structure already set. You can run the server and all the commands from manage.py in a visual way FROM the IDE and do code debugging and view the Python console (with Django environment loaded) from within. It also has support for other languages, such as Javascript, CSS, HTML, YAML (for database fixtures), PHP, etc. You can edit Django templates with support of special syntax highlighting. These are killer features for me and I totally love PyCharm. It performs a little lame at code completion, but I'm willing to give it a chance.
    • Wing IDE has also Django support and as a distinctive feature it supports Django template debugging. Its code completion is brilliant. Their live introspection of your code is amazing. It's a little bit behind with the UI (dated visuals, unable to move around tabs, etc) but still very promising. It has a Python shell embedded and it's able to create and run simple scripts without necessarily creating an entire project. It's very lightweight and runs smoothly.
    • Aptana: very useful for creating complex Javascript scripts, CSS and HTML. I use it when I need to do complex Javascript development, as it has support features for many Js frameworks, such as Prototype, Scriptaculous and jQuery.


    So, that tools do you use for your work?
  • Re: Help : will deploying django framework for youtube like projects possible and feasible.
    Board » General Category » General Discussion
    Sure, I'm glad to help ... keep us posted on your progress and what technologies/sollutions you come across. It's always good to hear new stuff and maybe I'll be able to give you a second opinion. Good luck!
  • Re: TypeError expected string, instancemethod found (Haystack)
    Board » Django » Views
    From what I see you first tried to define manually some stuff form Haystack (I haven't worked with it, so I don't know any details about it), after that you included the URL patterns it has by default and they work. So it seems you're set :)
    I'm glad you found the solution. Cheers!
  • Re: Help : found error when changing from GET to POST example.
    Board » Django » Models
    I think this tutorial explains it better than I could, I didn't work much with CSRF stuff, I've only had some issues in a project that I fixed easily after reading more about django's CSRF protection.

    http://docs.djangoproject.com/en/1.2/ref/contrib/csrf/
  • Re: problem with views and url
    Board » Django » Views
    Please give me some more details on how is your project organized, how many apps it has and if they do have their own views.py and urls.py files, or you are just using the global ones in the project root.

    From what I see in your source code, you are trying to make an app called 'video_detail' within your project. and your views.py and urls.py might be correct, but only within that app directory. You also have to corelate them with the urls.py form your root's urls.py

    But I'm just speculating now, I need more details on how is your entire project structured and what are the internal dependencies.
  • Re: Problems with Static files (Django newbie)
    Board » Django » Templates
    Hi all.

    I'm a beginner to Djago, python, etc. And a first time poster here. Look's like i'll be posting questions that have a lot of obvious answers. Also please forgive me for posting this in the wrong section.

    My problem currently is I am unable to reference my static folder. I have a template set up. When I go to http://127.0.0.1:8000/ it points to my templates/homepage/home.html page. On that page I'm trying to load an image that is located at static/img/image.png

    To reference to it i'm using <img src="{{ STATIC_URL }}img/image.png">.

    In my settings.py I have STATIC_URL ='/static/'

    Any help appreciated!
    How is your STATIC_ROOT defined? it has to be an absolute path to the filesystem.
    Also, if you are using django's development server (instead of Apache) you have to register your url for static files into your urls.py:
    from django.conf.urls.defaults import *
    from django.conf import settings
    
    urlpatterns = patterns('',
    	# ... blah blah blah...your app-specific url patterns...
    )
    
    # add this now
    urlpatterns += patterns('django.views.static',
    	( r'^%s(?P<path>.*)' % settings.STATIC_URL[1:], 'serve', {'document_root': settings.STATIC_ROOT} ), #for your site's static CSS, Js, etc.
    	( r'^%s(?P<path>.*)' % settings.MEDIA_URL[1:], 'serve', {'document_root': settings.MEDIA_ROOT} ), #for user-added files
    )
    

    Then the dev server knows how to serve these static files that you have. On a production server you don't need this in urls.py, as you'll have to specify in your Appache configuration how the static files should be served. Hope this helps.
  • Re: Help : will deploying django framework for youtube like projects possible and feasible.
    Board » General Category » General Discussion
    Hello ton ph, what you are saying is fairly possible, building a website like that is entirely possible in Django, but don't expect to get too many already-cooked features from start, like in a CMS, you'll have to build your own and maybe reuse some cool apps from the django community.

    About the personal webcam monitoring stuff, there's 2 options in my view:
    - using a standard USB webcam, and using/creating software that broadscasts the video stream (accessible with credentials, of course) ... that's a big pain and lots of low-level programming involved
    - using an IP camera, which can connect directly to your router, have its own ip, and with a little configuration can serve a webpage of its own with the video stream. All you'll have to do is integrate that webpage with your website, to make an homogenous system with good design consistency.
  • Re: Django / Python on a standalone Android Tablet
    Board » General Category » General Discussion
    Oh, now I get a more complete picture of your situation...my area of expertise doesn't cover mobile apps, but afaik Android supports some scripting languages (Python included), as it has this Android Scripting Environment (ASE) http://google-opensource.blogspot.com/2009/06/introducing-android-scripting.html, being able to run some scripts, and even use some of the internal Android Platform's API.

    Now I don't really know the whole concept and architecture behind this, probably you don't have the benefit of a classical Python installation (with PYTHONPATH and other environment variables), maybe it's even sandboxed to some degree.

    But if you're able to install some libraries/packages, then you are able to install django, as it doesn't come bundled with any platform-specific, binary packages ... it's all script :)
    On PC you can install Django over any bare-bone, standard distribution of Python, so there's still hope. As for database management, SQLite would serve your purpose very well (http://www.sqlite.org/), if supported by Android.

    My suggestion would be to ask some Android experts on how you can install/run Python and Python libraries on that platform. They should know better. And if you do manage to succeed, let us know!

    PS: Don't expect to be able to take a web app written in Django out of a Linux server, throw it on your tablet, and run it like there's no tomorrow. There are many platform-wise aspects to be taken into account, especially when porting/developing such an app for the mobile platform.
  • Re: Django / Python on a standalone Android Tablet
    Board » General Category » General Discussion
    If your iPhone/Tablet/whatever can run python, have all the standard libraries and maybe support database connectors within python (like mysqldb, sqllite or psycopg2, etc.) then there's no reason why you can't develop a web app directly from there.
    But you'll have to check the device's OS specs for that, anything written in python that's not platform-specific can run on any python-capable machine. And you'll need a command-line interface (Unix or Windows style, to be able to do the deployment), and who knows, maybe an Apache server installed for efficiency.

    Though I don't see any reason to do that. Developing a website from a mobile device. Think that your gadget should run as a web server when running it, and serve pages for itself continuously. I think it's a pretty consuming task for such a device imho.

    My advice: use a laptop ;)


Powered by Sphene Community Tools