小编roc*_*cky的帖子

错误:在apache上运行django时找不到目标WSGI脚本或无法统计

我在apache上运行django时遇到问题:

htdocs目录/博客/应用/主页/ urls.py:

url(r'^$', 'index', name="h_index"),
url(r'^about/$', 'about', name="h_about"),
url(r'^contact/$', 'contact', name="h_contact"),
url(r'^archive/$', 'archive', name="h_archive"),
Run Code Online (Sandbox Code Playgroud)

htdocs目录/博客/ urls.py

(r'^', include('apps.homepage.urls')),
Run Code Online (Sandbox Code Playgroud)

django.wsgi:

import os
import os.path
import sys

sys.path.append('D:/Coding/xampp/htdocs')
sys.path.append('D:/Coding/xampp/htdocs/blog')

os.environ['DJANGO_SETTINGS_MODULE'] = 'blog.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Run Code Online (Sandbox Code Playgroud)

httpd.conf中:

Alias /static/ "D:/Coding/xampp/htdocs/blog/static/"
WSGIScriptAlias /blog/ "D:/Coding/xampp/htdocs/blog/django.wsgi"
Run Code Online (Sandbox Code Playgroud)

当我运行"localhost/blog"时,它正在运行.但运行"localhost/blog/about /"或其他,这是错误:

[error] [client ::1] Target WSGI script not found or unable to stat:   .../htdocs/blog/django.wsgiabout, referer: http://localhost/blog/
Run Code Online (Sandbox Code Playgroud)

apache django django-templates django-views

6
推荐指数
1
解决办法
1万
查看次数

通过magento中的电子邮件ID获取有关客户的信息

我希望通过电子邮件ID获取客户信息,因此我在控制器中创建了一个包含内容的方法:

public function showAction(){
    $customer_email = "abc@mail.com";
    $customer = Mage::getModel("customer/customer");
    $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
    $customer->loadByEmail($customer_email);
    echo $customer->getId();
    echo $customer->getFirstName();
    echo $customer->getEmail(); 
}
Run Code Online (Sandbox Code Playgroud)

但是当它运行时它返回null值,我不知道为什么?请帮我

php magento magento-1.5 magento-1.7

4
推荐指数
1
解决办法
2万
查看次数

Jquery:在iframe中找不到元素

我有使用iframe的页面:

页面a.html:

<div id="results">
  <iframe src="../b.aspx"></iframe>
</div>
Run Code Online (Sandbox Code Playgroud)

现在我想在iframe中获取元素,所以我尝试:

<script type="text/javascript">
        jQuery(document).ready(function($) {
            var tmp = $('#results iframe').contents().find('html').html();
            alert(tmp);
        });
</script>
Run Code Online (Sandbox Code Playgroud)

但结果返回是:<head></head><body></body>,头部或身体内容不含.我需要帮助

html javascript iframe jquery

4
推荐指数
1
解决办法
8087
查看次数

未捕获的TypeError:无法读取未定义的dataTable的属性"className"

我有桌子:

HTML

<table id="mydata">
    <thead>
        <tr>
            <th>Data 1</th>
            <th>Data 2</th>
            <th>Data 3</th>
            <th>Data 4</th>
        </tr>
    </thead>
    <tbody>
        <tr class="main">
            <td class="data_1">A</td>
            <td class="data_2">B</td>
            <td class="data_3">C</td>
            <td class="data_4">D</td>
        </tr>
   </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

当我使用dataTable与jquery排序时:

JavaScript的

jQuery('#mydata').dataTable({
    "sDom": " ",
    "bPaginate": false,
    "bInfo": false,
    'bFilter':false,                        
    "aoColumns": [
        null,               
        null,
        null,
        null
    ]
});
Run Code Online (Sandbox Code Playgroud)

它奏效了.

但是,当我为main添加子行时:

HTML

<table id="mydata">
    <thead>
        <tr>
            <th>Data 1</th>
            <th>Data 2</th>
            <th>Data 3</th>
            <th>Data 4</th>
        </tr>
    </thead>
    <tbody>
        <tr class="main">
            <td class="data_1">A</td>
            <td class="data_2">B</td>
            <td class="data_3">C</td>
            <td class="data_4">D</td>
        </tr> …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-plugins datatables jquery-datatables

1
推荐指数
1
解决办法
9677
查看次数

为什么get_absolute_url()不起作用

我是django的新手,我遇到了get_absolute_url()的问题:我的模型:

class Band(models.Model):
B_Name = models.CharField(max_length=30, primary_key=True)
Country = models.CharField(max_length=30)
genre = models.ForeignKey(Genre)
imageband = models.ImageField(upload_to='images/band')

def __unicode__(self):
    return self.B_Name

@models.permalink
def get_absolute_url(self):
    return '/genre/%s/%s/' % (self.B_Name, self.genre)
Run Code Online (Sandbox Code Playgroud)

我的网址:

url(r'^genre/(\d+)/$', 'genre', name="genre"),  
url(r'^genre/(?P<B_Name>)/(?P<genre>\[-\w]+)/$', 'thu'),    
Run Code Online (Sandbox Code Playgroud)

我的观点:

def genre(request, url):
template = 'genre/genre.html'
if url=='1':
    tmp = Band.objects.raw('SELECT B_Name, Country FROM data_band WHERE genre_id=%s', ...)
if ....
......
return render_to_response(template,{'tmp':tmp})


def thu(request):
template = 'genre/thu.html'
tmp = Band.objects.raw('SELECT B_Name, genre FROM data_band')
return render_to_response(template,{'tmp':tmp})
Run Code Online (Sandbox Code Playgroud)

我的模板genre.html:

{% for x in tmp %}
<tr> …
Run Code Online (Sandbox Code Playgroud)

django django-models

-1
推荐指数
1
解决办法
971
查看次数