Cnprog Installed and Running but where is admin?

7 views
Skip to first unread message

Bobby

unread,
Dec 1, 2009, 10:54:21 PM12/1/09
to CNProg open discussion
Hi, I know this may sound noob but I am not a python programmer.

Where do I locate the administrator panel for django cnprog so I can
add badges and administrate my new cnprog website www.askagamer.net

Thanks!

Bobby

unread,
Dec 2, 2009, 9:47:13 PM12/2/09
to CNProg open discussion
Also, how do I add an image to a badge like they did on stackoverflow
for the WOOT badge.

hsk

unread,
Dec 3, 2009, 4:55:29 PM12/3/09
to CNProg open discussion
For admin panel:
http://www.askagamer.net/nimda/ (It's admin backwards, you should
check out urls.py file.)

Bobby

unread,
Dec 4, 2009, 1:37:05 PM12/4/09
to CNProg open discussion
I did find the admin panel a few minutes after posting here. What
about the image badges? How can I get an image like the woot badge on
SO.

On Dec 3, 1:55 pm, hsk <contacths...@gmail.com> wrote:
> For admin panel:http://www.askagamer.net/nimda/(It's admin backwards, you should

hsk

unread,
Dec 4, 2009, 4:17:25 PM12/4/09
to CNProg open discussion
I haven't used the badges stuffs... but I can tell you how to find one
easily.

If you don't know these, IMHO, you should be familiar with these.
1) Know your grep commands or have a tool that can search the entire
folder. (I use Notepad++)
2) Know how to use Firebug. (very useful tool)

When user asks for sites. In Django you go through urls.py which
redirects to views and templates.

http request -> urls.py -> appropriate views.py method (interacts with
the model/db here) -> appropriate template file -> html + css + etc.

For example if you take a look at urls.py, you'll find:
url(r'^%s$' % _('badges/'), app.badges, name='badges'),

Since the following is in the header of urls.py:
from forum import views as app
you should go to forum/views.py and search for badges

If you are unfamiliar with variable, name, etc, you should just do
folder-wide search and you'll find the where it came from easily
without having to go through the Django tutorial much. If you want to
see the model, check out models.py which should contain Badge class.

In Django, MVC is MTV (Model Template View) respectively so don't get
confused if View is doing what controller should be doing.
Also, for your woot thing, the quick and dirty solution would be using
filters under forum/templatetags/extra_filters.py and implementing it
in the template files.

I hope this helps.
cheers,

***on a side note. Isn't woot logo owned by woot.com?

hsk

unread,
Dec 5, 2009, 1:31:59 PM12/5/09
to CNProg open discussion
>But if I implement it in the extra_filters.py wont it put the image I
>add into every badge? How do I just put an image into one badge. And
>no I am not going to be stealing woot.com logo and using it. That was
>just an example because www.stackoverflow.com has the woot badge and I
>want to know how they added an image.

One way to do it is via storing your special html code in a
dictionary...
I am pretty rusty in python.
http://docs.python.org/tutorial/datastructures.html#dictionaries

You could check the Badge.name with an if statement and replace it or
not.
Multiple if statements can work as well, as long as it's not too long,
then you should better go with using the dictionary.
But then again, there can't be too many badges, this could be faster.

Another way could be modifying badge to carry optional html code and
maybe a boolean portion indicating whether it has the image or not.
(I wouldn't go that far because it's too much work for no performance
gain.)

>Can you also explain why when I click on a badge that has been
>awarded, it gives an error 500 page instead of displaying who was
>awarded the badge. Visit http://askagamer.com/account/signin/ to see
>what I am talking about. Many thanks to this wonderful and helpful
>community.

I thought I mentioned I don't know much about the badges. :| After
doing some brief investigation, it seems like you need to use sql
queries to add badge types.
I realize that the code base I am using is probably too old.
I suggest you search already working badges (with their badge id) and
do your investigation. It probably boil down to adding some badges
into the sql queries.
I would begin with searching for "Adventurous", or "adventurous".

Btw, the way you could investigate would be looking at the link (is it
broken?), then looking at urls.py (read some docs about urls.py +
Internationalization)
then looking at the appropriate method... etc. Trust me, reading that
manual, will help.


Hope this helps. Remember. If something seems wrong, take a look at
the html code with Firebug -> urls.py -> ... debugging method.
(Also, turning the debugger on helps too, on your development
platform.)

Go to settings.py remove comments on the following and make sure debug
is on for development platform, pretty useful for doing stack tracing.
(shows sql queries as well)
#'debug_toolbar.middleware.DebugToolbarMiddleware',

cheers,

Bobby

unread,
Dec 9, 2009, 1:58:31 AM12/9/09
to CNProg open discussion
You can see the error debug here, http://www.askagamer.com/badges/7/1337%20Hax0r
what do I do?

On Dec 5, 10:31 am, hsk <contacths...@gmail.com> wrote:
> >But if I implement it in the extra_filters.py wont it put the image I
> >add into every badge? How do I just put an image into one badge. And
> >no I am not going to be stealing woot.com logo and using it. That was
> >just an example becausewww.stackoverflow.comhas the woot badge and I
> >want to know how they added an image.
>
> One way to do it is via storing your special html code in a
> dictionary...
> I am pretty rusty in python.http://docs.python.org/tutorial/datastructures.html#dictionaries
>
> You could check the Badge.name with an if statement and replace it or
> not.
> Multiple if statements can work as well, as long as it's not too long,
> then you should better go with using the dictionary.
> But then again, there can't be too many badges, this could be faster.
>
> Another way could be modifying badge to carry optional html code and
> maybe a boolean portion indicating whether it has the image or not.
> (I wouldn't go that far because it's too much work for no performance
> gain.)
>
> >Can you also explain why when I click on a badge that has been
> >awarded, it gives an error 500 page instead of displaying who was
> >awarded the badge. Visithttp://askagamer.com/account/signin/to see

Bobby

unread,
Dec 9, 2009, 2:04:04 AM12/9/09
to CNProg open discussion
I figured it out, there was a typo on line 30 {% for award in
awards %} so I changed it to {% for award in award %}

Now it works, thanks for the debug idea!

On Dec 5, 10:31 am, hsk <contacths...@gmail.com> wrote:
> >But if I implement it in the extra_filters.py wont it put the image I
> >add into every badge? How do I just put an image into one badge. And
> >no I am not going to be stealing woot.com logo and using it. That was
> >just an example becausewww.stackoverflow.comhas the woot badge and I
> >want to know how they added an image.
>
> One way to do it is via storing your special html code in a
> dictionary...
> I am pretty rusty in python.http://docs.python.org/tutorial/datastructures.html#dictionaries
>
> You could check the Badge.name with an if statement and replace it or
> not.
> Multiple if statements can work as well, as long as it's not too long,
> then you should better go with using the dictionary.
> But then again, there can't be too many badges, this could be faster.
>
> Another way could be modifying badge to carry optional html code and
> maybe a boolean portion indicating whether it has the image or not.
> (I wouldn't go that far because it's too much work for no performance
> gain.)
>
> >Can you also explain why when I click on a badge that has been
> >awarded, it gives an error 500 page instead of displaying who was
> >awarded the badge. Visithttp://askagamer.com/account/signin/to see

Bobby

unread,
Dec 12, 2009, 4:24:46 AM12/12/09
to CNProg open discussion
Hi hsk,

Do you know why my website would say the following listed below after
I restarted my server? Do you know a fix for this, you can see the
error on www.askagamer.com

Thank you tons for your help!

-------
Bad Gateway

The proxy server received an invalid response from an upstream server.

Additionally, a 502 Bad Gateway error was encountered while trying to
use an ErrorDocument to handle the request.
------
Reply all
Reply to author
Forward
0 new messages