正在開發項目時正確的站點項目結構

[英]Proper site project structure when project under development


I am trying at first time develop site on my own, and don't have any real experience, but have a bit of frameworks and technologies in use. At the current moment I am using django which runs under local apache server. And for the front-end part I am using bootstrap sources with less. And I have to use git. So project folder will contain a lot of that releases site mustn't.

我是第一次嘗試自己開發網站,並沒有任何實際經驗,但有一些框架和技術在使用。目前我正在使用在本地apache服務器下運行的django。而對於前端部分,我使用較少的bootstrap源。我必須使用git。所以項目文件夾將包含很多那些發布網站不得。

The apache root directory, default one that was offered, is var/www/html/bestsite. It is not so convenient in use, because it requires root user, so every editor have to be run under root user.

apache根目錄,默認提供的是var / www / html / bestsite。它使用起來不太方便,因為它需要root用戶,所以每個編輯器都必須在root用戶下運行。

Well next logical step is reconfig apache to use other path, let's say home/user/projects/bestsite, but it again here I will have a lot of unnecessary for releases site mustn't. I can write some script or use Grunt to copy only bestsite's content back into var/www/html/bestsite, but I have doubts about rationality of this solution.

那么下一個邏輯步驟是重新配置apache以使用其他路徑,讓我們說home / user / projects / bestsite,但它再次在這里我將有很多不必要的發布網站一定不能。我可以編寫一些腳本或使用Grunt將bestsite的內容復制回var / www / html / bestsite,但我懷疑這個解決方案的合理性。

Finally the question is how it should be? How do you organize your projects?

最后問題是它應該如何?你如何組織你的項目?

1 个解决方案

#1


1  

For development don't use Apache. use the built-in development server. You can run it with python manage.py runserver. When it comes to less or sass I would recommend to use django-compressor. It integrates well with the django development server where it generates your css on the fly.

對於開發,不要使用Apache。使用內置的開發服務器。您可以使用python manage.py runserver運行它。當談到較少或sass我會建議使用django壓縮機。它與django開發服務器很好地集成,可以動態生成你的css。

I would suggest to use a vagrant box for development. So you can develop on a production like system. It's also possible to spin up Amazon EC2 instances with vagrant.

我建議使用一個流浪盒進行開發。所以你可以開發類似生產的系統。也可以使用vagrant來啟動Amazon EC2實例。

You are free in sense of project structure if the configuration is right. It depends heavily on the size of your project. For small projects the default structure fits well. I personally wrap this django-project folder with a folder where git, configs, etc. find there place.

如果配置正確,您在項目結構方面是自由的。這在很大程度上取決於項目的規模。對於小型項目,默認結構非常適合。我親自將這個django-project文件夾包含在git,configs等找到的文件夾中。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2015/07/05/72f6914cd0786e260d354d7f9c6e851.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com