Jump to content


sopython

Member Since 21 Mar 2019
Offline Last Active Apr 15 2019 03:54 AM
-----

Topics I've Started

About the static file path

12 April 2019 - 09:52 PM

I want to use a static file. So I create a static folder under the project folder and put the file under the static folder. And I also added the needed info in settings.py, url.py and the html. But it still doesn't work. Is the something wrong in my files? Or there is something which need the admin's configure?

 

What have been added in settings.py:

 

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

... ...

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static_collected')
 
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static"),
  ]

STATICFILES_FINDERS = (
    "django.contrib.staticfiles.finders.FileSystemFinder",
    "django.contrib.staticfiles.finders.AppDirectoriesFinder"

 

*****************************************************************************

What added in url.py:

 

from django.conf.urls.static import static

 

**************************************************

What added in html:

 

{% load static %}

 

background-image: url("{% static "pyStocks/imgs/background-cloth.png"%}");

 

 


[Solved] How to deploy different Django apps under different sub-domains on Heliohost

27 March 2019 - 08:25 AM

I have tried the tutorial on wiki.helionet.org/Django, it works well. But now I want to deploy two Django apps on two subdomains on heliohost. I created two subdomians (e.g. Hello1 and Hello2), and the sub-folders Hello1 and Hello2 were created under public_html. Then I upload the Django apps to these subfolders and did the similar configurations to the .htaccess, dispatch.wsgi, etc separately. but it didn't work.

 

Is there any tutorial for this kind of situation? 

 

Thanks!