After Share Hosting...
 
Notifications
Clear all

After Share Hosting with cPanel

3 Posts
2 Users
0 Reactions
76 Views
0
Topic starter

Dear teacher I don't know how to do, after hosting django with cPanel "http://blog-api.princeconsumer.com/" I got the error "

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

" when I try click on another product.

IMG 1866 rathank.com Mohaiminul - Team Rathan 27/09/2024 5:25 pm

@moneaksekanhem2016 The error you're encountering might be due to a misconfiguration in your URLs or an issue with the static and media files setup. Please ensure that your URL routing and static/media file configurations are correct. Additionally, you can check the error logs for more details. Once you have the logs, feel free to share them with us, and we can assist you more effectively in resolving the issue.

32f2aae4aa2b82c4d052ef2b85a53d33?s=36&d=mm&r=g rathank.com NHEM Moneakseka Topic starter 28/09/2024 12:49 pm

(settings.py)
DEBUG = config('DEBUG', default=True, cast=bool)

ALLOWED_HOSTS = ['blog-api.princeconsumer.com','www.blog-api.princeconsumer.com']

STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR /'static'
STATICFILES_DIRS = [
'greatkart/static',
]

#media files configuration
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR /'media'

(urls.py)
from django.contrib import admin
from django.urls import include, path
from . import index
from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
path('admin/', include('admin_honeypot.urls', namespace='admin_honeypot')),
path('mylogin/', admin.site.urls),
path('', index.home, name='home'),
path('store/', include('store.urls')),
path('cart/', include('carts.urls')),
path('accounts/', include('accounts.urls')),

#Orders
path('orders/', include('orders.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

But still erorr "Not Found
The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."
I don't know how to do .

IMG 1866 rathank.com Mohaiminul - Team Rathan 28/09/2024 4:01 pm

Hi @moneaksekanhem2016,

It's hard to provide specific guidance for deploying the project on cPanel, as we’ve shown how to deploy the project on AWS Elastic Beanstalk in the deployment section. I suggest following that tutorial to deploy your application on AWS, as I believe that would be a better option.

However, if you prefer to deploy your application on cPanel, I can provide some resources that might help:

Documentation: https://dev.to/odhiambo/how-to-deploy-your-django-web-app-and-connect-a-mysql-database-in-cpanel-43l3

YouTube Video: https://youtu.be/h2w8oNw_W80?si=cE0tgNKn0vh3ynTG
Another YouTube Video: https://youtu.be/Va2X_PrTXoA?si=GYZ2ad3ZCz4movyd

If you need any further help, feel free to ask!

Share: