python - Django - No display on browser after deployment on ubuntu server -


i have deployed django project in our personal ubuntu server using apache2 , mod-wsgi. unable display on browser. shows "error" @ corner of page. please suggest if doing wrong.

my settings.py:

import os # build paths inside project this: os.path.join(base_dir, ...) base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))  secret_key = 'blah blah blah'  # security warning: don't run debug turned on in production! debug = true  allowed_hosts = []  admins = (     'surajitmishra@gmail.com', )  # application definition  installed_apps = [     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.messages',     'django.contrib.staticfiles',     'mod_wsgi.server',     'publications',     '....',     'crispy_forms',     'widget_tweaks', ]  logging = {     'version': 1,     'disable_existing_loggers': false,     'handlers': {         'console': {             'class': 'logging.streamhandler',         },     },     'loggers': {         'django': {             'handlers': ['console'],             'level': os.getenv('django_log_level', 'info'),         },     }, }  site_id = 1  crispy_template_pack = 'bootstrap3'  auth_user_model = 'user_profile.myuser'  email_backend = 'django.core.mail.backends.smtp.emailbackend'  # during development      middleware = [     'django.middleware.security.securitymiddleware',     'django.contrib.sessions.middleware.sessionmiddleware',     'django.middleware.common.commonmiddleware',     'django.middleware.csrf.csrfviewmiddleware',     'django.contrib.auth.middleware.authenticationmiddleware',     'django.contrib.messages.middleware.messagemiddleware',     'django.middleware.clickjacking.xframeoptionsmiddleware', ]   root_urlconf = 'pubnet.urls'  templates = [     {         'backend': 'django.template.backends.django.djangotemplates',         'dirs': [os.path.join(base_dir, 'templates')],         'app_dirs': true,         'options': {             'context_processors': [                 'django.template.context_processors.debug',                 'django.template.context_processors.request',                 'django.contrib.auth.context_processors.auth',                 'django.contrib.messages.context_processors.messages',             ],         },     }, ]  redis_host = 'localhost' redis_port = 6379 redis_db = 0      wsgi_application = 'pubnet.wsgi.application'      databases = {     'default': {         'engine': 'django.db.backends.mysql',         'name': 'pubnet',         'user': 'root',         'password': 'password',         'host': '127.0.0.1',   # or ip address db hosted on         'port': '3306',     } }      auth_password_validators = [     {         'name': 'django.contrib.auth.password_validation.userattributesimilarityvalidator',     },     {         'name': 'django.contrib.auth.password_validation.minimumlengthvalidator',     },     {         'name': 'django.contrib.auth.password_validation.commonpasswordvalidator',     },     {         'name': 'django.contrib.auth.password_validation.numericpasswordvalidator',     }, ]   image_types = ['application/pdf; charset=binary',                'text/plain;',                'text/csv;', ]      # internationalization # https://docs.djangoproject.com/en/1.11/topics/i18n/  language_code = 'en-us'  time_zone = 'utc'  use_i18n = true  use_l10n = true  use_tz = true   # static files (css, javascript, images) # https://docs.djangoproject.com/en/1.11/howto/static-files/  static_url = '/static/'  static_root = os.path.join(base_dir, 'static', 'static_root')  staticfiles_dirs = (     os.path.join(base_dir, 'static', 'static_dirs'), )  media_url = '/media/'  media_root = os.path.join(base_dir, 'media') 

my urls.py:

from django.conf.urls import include, url django.contrib import admin django.conf import settings django.views.generic.base import templateview django.conf.urls.static import static django.contrib.auth import views auth_views django_filters.views import filterview publications.filter import userfilter  admin.autodiscover()  urlpatterns = [     url(r'^admin/', admin.site.urls),     url(r'^', include('publications.urls', namespace='publication')),     ......      url('^', include('django.contrib.auth.urls')),     ]  if settings.debug:     urlpatterns += static(settings.static_url, document_root=settings.static_root)     urlpatterns += static(settings.media_url, document_root=settings.media_root) 

my publications/urls.py:

from django.conf.urls import url . import views urlpatterns = [     url(r'^$', views.index, name='index'),     url(r'^pubnet/$', views.post_list, name='post_list'),     .....         ] 

/etc/apache2/sites-available/pubnet.conf:

<virtualhost *:80>          servername pubnet.com         serveralias www.pubnet.com         serveradmin root          documentroot /var/www/pubnet         wsgiscriptalias / /var/www/pubnet/pubnet/wsgi.py         <directory "/var/www/pubnet/pubnet/">            require denied         </directory>          <directory "/var/www/pubnet/pubnet">         <files wsgi.py>            require denied         </files>         </directory>          errorlog /var/www/logs/error.log         customlog /var/www/logs/custom.log combined          alias /media/ /var/www/pubnet/media/         alias /static/ /var/www/pubnet/static/          <directory /var/www/pubnet/static>            require denied         </directory>          <directory /var/www/pubnet/media>            require denied         </directory>  </virtualhost> 

/var/www/pubnet/pubnet/wsgi.py:

import os import sys import django.core.handlers.wsgi  # calculate path based on location of wsgi script. apache_configuration= os.path.dirname(__file__) project = os.path.dirname(apache_configuration) workspace = os.path.dirname(project) sys.path.append(workspace) sys.path.append(project)  # add path 3rd party django application , django itself. sys.path.append('/var/www/pubnet') os.environ['django_settings_module'] = 'pubnet.apache.override'  os.environ.setdefault("django_settings_module", "pubnet.settings") django.core.wsgi import get_wsgi_application application = get_wsgi_application() 

/var/log/apache2/error.log:

[thu jul 27 15:23:32.498309 2017] [mpm_prefork:notice] [pid 30495] ah00163: apache/2.4.7 (ubuntu) php/5.5.9-1ubuntu4.21 mod_wsgi/3.4 python/2.7.6 mod_perl/2.0.8 perl/v5.18.2 configured -- resuming normal operations [thu jul 27 15:23:32.498403 2017] [core:notice] [pid 30495] ah00094: command line: '/usr/sbin/apache2' [thu jul 27 16:30:29.106801 2017] [mpm_prefork:notice] [pid 30495] ah00169: caught sigterm, shutting down [thu jul 27 16:33:32.680148 2017] [mpm_prefork:notice] [pid 21253] ah00163: apache/2.4.7 (ubuntu) php/5.5.9-1ubuntu4.21 mod_wsgi/3.4 python/2.7.6 mod_perl/2.0.8 perl/v5.18.2 configured -- resuming normal operations [thu jul 27 16:33:32.680237 2017] [core:notice] [pid 21253] ah00094: command line: '/usr/sbin/apache2' [thu jul 27 17:19:21.703341 2017] [mpm_prefork:notice] [pid 21253] ah00169: caught sigterm, shutting down 

i have kept '777' permission pubnet directory now.

please help.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -