Forums

Problen installing ANGULAR

Hi guys,

Does anyone how can i configure Angular with Django . Please I am spending a lot of time and I cannot figure out. After doing npm install and did npm run build to go to production:

I dont know how to set the urls go to my angular interface. Now I can see Django Rest framework URL but I cannot see the angular files.

Maybe i have to configure the static folder?

Anyway, I need help to configure ANGULAR . I would be so grateful

Thanks in advance

Hi, what errors do you see in your logs?

I dont have errors ore i cant see them. my project is:

my_project ->

|->my_project
     |->settings.py

|->frontend
    |-> app
       |->dist  ( this folder is generated after ng build --prod)
|->static ( maybe i have to include somehow the files here, now i can see just sytles of django-rest but my index page it is not showing)
   |->admin
   |->rest-framework

So how can I see my angular App instead Django-rest-Framework

Thanks in advance

To see your logs go to the Web page on your account and look for the "Log files" section.

these are my links:

  • Access log: mazziitoozzb.pythonanywhere.com.access.log

  • Error log: mazziitoozzb.pythonanywhere.com.error.log

  • Server log: mazziitoozzb.pythonanywhere.com.server.log

Are you able to see them? I didnt see any error related to angular. My angular project is in the dist folder that I said few messages before. In addition if you go to my website you will see that DRF interface is working fine.

Yes, I can see them. We encourage our users to read the logs by themselves and learn how to debug their webapps. It looks like that the static files mappings could not be set up correctly as well as the urls in your Django app. For the static files -- please check those help pages: https://help.pythonanywhere.com/pages/StaticFiles/, https://help.pythonanywhere.com/pages/DebuggingStaticFiles/ .

Please I already check the logs you only can see a problem with static/bootstrap.min.css because this file does not exist but this is from django rest framework. Django rest framework must not be visible for the client. I want to see the Angular files which are inside my frontend folder. Let me explain what i did and tell me if something is wrong:

  1. Create environment
  2. clone my project and install packages
  3. change patch in WSGI configuration file and prepare everything for django.
  4. do the all process to update node via nvm
  5. run npm install (to install angular) and after that ng build --prod
  6. After ng build a folder call dist appear as usually.
  7. in settings.py allow host and add statci_root
  8. go back to the folder that is the whole project and run python amange.py collect static
  9. Go to web settings and change the /static/ path 8 static folder appear but inside I am only able to see css and js for django rest framework
  10. Files inside dist folder has a lot of js and css files so i dont know why there are not inside static I dont know where should i put the angular app to make it works

Have you run the "collectstatic" management command to collect all of the files from your various Django apps into the STATIC_ROOT folder?

Yes but when i do that only the files who cames from djangorest are collected . The angular files are not going inside this folder. I am so lost

static folder

home directory

dist/test folder after ng build --prod

Now I have the angular files in my static folder. How can i see the index.html and its styles instead of django-rest framework interface

I see that you're talking to us over email as well, so to reduce duplication we'll respond to that.